Skip to content

Instantly share code, notes, and snippets.

View jabenninghoff's full-sized avatar

John Benninghoff jabenninghoff

View GitHub Profile
@jabenninghoff
jabenninghoff / ssh-require-publickey-external.md
Last active December 20, 2015 16:15
Configure ssh to require public-key based authentication only for external networks

Given: my local network is 10.1.1.0/24, my username is jabenninghoff, my ssh host is ssh.example.com, my host's address is 10.1.1.17, my ssh port is 22, and I'm connecting from either 10.1.1.33 (locally) or 172.16.1.20 (remotely)
When: connecting from the local network
Then: allow default ssh authentication methods

When: connecting from other networks
Then: require key-based authentication

Configure using a Match rule:

Match Address *,!10.1.1.*
@jabenninghoff
jabenninghoff / osx-mount-drives-on-boot.md
Created September 10, 2016 16:07
Configure OS X to mount external drives at boot

By default, OS X only mounts external drives (USB, Firewire, Thunderbolt, etc.) when you log in, and unmounts them when you log out or reboot. To change this behavior, enable AutomountDisksWithoutUserLogin.

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

Installing OS X Server also enables this setting.

Alternatively, you can create the /Library/Preferences/SystemConfiguration/autodiskmount.plist with the following content:

@jabenninghoff
jabenninghoff / brew-list-depends.sh
Created September 11, 2016 14:51
List all installed brews along with their dependencies
#!/bin/sh
# one-liner courtesy of http://zanshin.net/2014/02/03/how-to-list-brew-dependencies/
brew list | while read cask; do echo -n "$cask ->"; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done
@jabenninghoff
jabenninghoff / osx-vnc-hidden-options.md
Last active March 15, 2024 11:40
RemoteManagement "hidden" options

macOS Sierra (and possibly earlier) has some "hidden" screen sharing options:

If you're connecting to VNC using ssh tunneling, you can force macOS to listen only on localhost:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement.plist VNCOnlyLocalConnections -bool yes

In newer versions of macOS, screen sharing will automatically re-lock the screen when you disconnect if it was locked when you first connected. To change this behavior, use:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement RestoreMachineState -bool NO

@jabenninghoff
jabenninghoff / repro-5346.sh
Created January 22, 2017 14:50
Script to reproduce bundler issue #5436
#!/bin/sh
set -ex
mkdir -p /tmp/repro-5346
cd /tmp/repro-5346
cat > Gemfile <<EOF
source 'https://rubygems.org'
require 'json'
@jabenninghoff
jabenninghoff / homebrew-formula-pr-checklist.md
Last active February 13, 2017 04:38
Homebrew formula pull request checklist
  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

@jabenninghoff
jabenninghoff / fix-osx-vnc-black-screen.md
Created August 30, 2017 12:21
Fix the VNC "Black Screen" on older versions of OS X

Occasionally on older versions of OS X, connecting to a remote system via VNC will result in a "Black Screen" that is non-responsive. To fix this, kill the loginwindow process:

$ ps ax | grep loginwindow
   83   ??  Ss     0:00.89 /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow console
$ sudo kill 83

loginwindow will automatically restart and the login screen will appear.

Thanks to Mac Mini World!

@jabenninghoff
jabenninghoff / graylog-mongo.md
Last active December 10, 2017 15:14
Instructions for upgrading the graylog MongoDB database

Graylog uses mongo:3 in its docker-compose image, which automatically pulls the latest production version of MongoDB, but does not set the feature compatibility version. This will cause databases created in 3.2 or earlier to fail to start in 3.6.

Per https://docs.mongodb.com/manual/reference/command/setFeatureCompatibilityVersion/, this will show the current running compatibility version and upgrade from 3.4 to 3.6:

docker exec -it mongo_container /bin/bash
mongo
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
exit
exit
patch file to implement workaround from https://github.com/oracle/vagrant-boxes/issues/178
--- /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb.orig 2019-10-14 12:01:06.000000000 -0500
+++ /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb 2020-01-18 14:17:54.000000000 -0600
@@ -64,6 +64,7 @@
"5.1" => Version_5_1,
"5.2" => Version_5_2,
"6.0" => Version_6_0,
+ "6.1" => Version_6_1,
}
@jabenninghoff
jabenninghoff / disable-catalina-upgrade.md
Last active March 24, 2021 00:22
Disable Catalina upgrade notifications and