Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
@mcandre
mcandre / Makefile.patch
Last active May 21, 2019 21:10
mkpasswd build patch for macOS
--- whois-5.4.2/Makefile 2019-05-21 15:48:32.000000000 -0500
+++ whois-5.4.2/Makefile.new 2019-05-21 15:49:55.000000000 -0500
@@ -62,8 +62,12 @@
DEFS += -DHAVE_CRYPT_H -DHAVE_LINUX_CRYPT_GENSALT -D_OW_SOURCE
mkpasswd_LDADD += -lcrypt -lowcrypt
else
+ifeq ($(shell $(PKG_CONFIG) --exists 'libcrypto' || echo NO),)
+mkpasswd_LDADD += $(shell $(PKG_CONFIG) --libs libcrypto)
+else
mkpasswd_LDADD += -lcrypt
@mcandre
mcandre / css-centering.md
Created April 11, 2019 20:06
Actual CSS vertical and horizontal centering for arbitrary page elements
@mcandre
mcandre / jq-truncate.md
Created April 11, 2019 15:08
jq truncate rows
$ jq -s -r '.[:1000] | .[]' <in-file> > <out-file>
@mcandre
mcandre / csslint-recursive.sh
Created April 9, 2019 21:26
csslint recursively
#!/bin/sh
node node_modules/csslint/dist/cli.js --exclude-list=node_modules .
@mcandre
mcandre / ubuntu-show-hidden-files.md
Created March 23, 2019 20:23
Ubuntu: Show Hidden Files

In the Nautilus file browser, press Control+H to toggle displaying hidden files on or off.

@mcandre
mcandre / go-log-show-line-numbers.md
Created March 1, 2019 16:01
Go log show line numbers
log.SetFlags(log.LstdFlags | log.Lshortfile)
@mcandre
mcandre / mirbsd-find-delete.md
Last active February 3, 2019 15:11
How to delete files with the UNIX find utility in MirBSD

Dry run:

find . -name '<pattern>' -print

Execute:

find . -name '' -print -exec rm -rf {} \;
$ cd /usr/ports/net/wget
$ sudo mmake install clean
===> Checking files for wget-1.10.2-3
>> wget-1.10.2.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch /usr/ports/Distfiles/wget-1.10.2.tar.gz from http://ftp.gnu.org/gnu/wget/.
100% |***********************************************************| 1184 KB 00:00
>> Size matches for /usr/ports/Distfiles/wget-1.10.2.tar.gz
>> wget_1.10.2-2.diff.gz doesn't seem to exist on this system.
>> Attempting to fetch /usr/ports/Distfiles/wget_1.10.2-2.diff.gz from http://httpredir.debian.org/debian/pool/main/w/wget/.
ftp: Error retrieving file: 404 Not Found
@mcandre
mcandre / mksh-find-command.md
Created January 31, 2019 00:54
How to find where a command is defined in mksh (e.g. MirOS/MirBSD)

Both command and type are missing sooo

  • which (aliased to whence)
  • whence (mksh built-in)
  • sudo find / -type f -name -print 2&gt;/dev/null