Skip to content

Instantly share code, notes, and snippets.

View yholkamp's full-sized avatar

Yorick Holkamp yholkamp

View GitHub Profile
@yholkamp
yholkamp / how-to-restore.md
Created December 11, 2021 12:24 — forked from AmazingTurtle/how-to-restore.md
restore access to unifi controller

Restore access to a unifi controller

When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.

Warning

Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.

Steps

Keybase proof

I hereby claim:

  • I am yholkamp on github.
  • I am yholkamp (https://keybase.io/yholkamp) on keybase.
  • I have a public key ASBvpVAI4v2waFCamwQTVdCoE_p72e7VwdiFWPTiDZCOfAo

To claim this, I am signing this object:

@yholkamp
yholkamp / local_history.rb
Created April 28, 2017 14:05
Print git commits made in the last x time
require "rubygems"
require "pp"
require "colorize"
if ARGV.count == 0
puts "ERROR: Please provide a directory to scan for git repositories"
Kernel.exit
end
DIR=ARGV[0]
08a479b5fcc3bcd0d4ba6183a177e1c1

Keybase proof

I hereby claim:

  • I am yholkamp on github.
  • I am nextpulse (https://keybase.io/nextpulse) on keybase.
  • I have a public key ASDSZHPC8XgC9njMEq7K5b2Kl6D6jQbt7QV56Je27-I2bAo

To claim this, I am signing this object:

@yholkamp
yholkamp / redis-master-discovery.sh
Last active July 6, 2016 17:02
Connect to Redis master with Sentinel-powered master discovery
# Provide the IP/port to any Redis server currently in a Sentinel cluster
master=$(redis-cli -h 10.0.1.57 -p 26379 SENTINEL get-master-addr-by-name redis-cluster)
arr=()
while read -r line; do
arr+=("$line")
done <<< "$master"
echo "Redis master is at ${arr[0]}:${arr[1]}"
# Connect to the master node with redis-cli:
@yholkamp
yholkamp / private.xml
Created December 3, 2015 11:42
Karabiner lock screen config
<?xml version="1.0"?>
<root>
<item>
<name>Custom PC Style Lock Screen (Lock screen with ctrl-command--L)</name>
<identifier>remap.custom_pc_style_lock_screen</identifier>
<autogen>
__KeyToKey__
KeyCode::L, ModifierFlag::CONTROL_L, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND,
ConsumerKeyCode::POWER, ModifierFlag::CONTROL_L, ModifierFlag::SHIFT_L,
</autogen>
@yholkamp
yholkamp / Gemfile
Created October 16, 2015 12:28 — forked from mm53bar/Gemfile
Be sure to install the datadog agent on your server before applying this code to your app. Instructions are at https://app.datadoghq.com/account/settings#agent or use my Sunzi recipe at https://github.com/Shift81/sunzi-recipes/blob/master/ubuntu/precise/datadog.sh
gem 'dogstatsd-ruby'
@yholkamp
yholkamp / ezvzdump
Created October 15, 2011 21:34
ezvzdump with flexible scp/sftp backup synchronization
#!/bin/bash
# ezvzdump
VEIDS="100"
LOCAL_COPIES=7
REMOTE_COPIES=3
# The local path that this script will rsync the VE's to.
LOCAL_PATH="/vz/dump/"
# File Line Location
0 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
1 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
2 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb 221 in `setup_bundler_support'
3 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/rack/application_spawner.rb 105 in `run'
4 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb 323 in `report_app_init_status'
5 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/rack/application_spawner.rb 87 in `run'
6 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/rack/application_spawner.rb 65 in `spawn_application'
7 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb 252 in `safe_fork'
8 /home/np/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.15/lib/phusion_passenger/rack/application_spawner.rb 58 in `spawn_application'