Skip to content

Instantly share code, notes, and snippets.

@kennwhite
kennwhite / centos-vbox-on-mac
Last active August 29, 2015 14:27 — forked from mjwall/centos-vbox-on-mac
setup centos in virtualbox on mac osx
- install virtual box
- download minimal iso from http://yum.singlehop.com/CentOS/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso
- create vm, use redhat 64
- in settings, storage, point the controller IDE to the iso
- run it
- once it reboots, you need networking
- run dhclient eth0
- yum install system-config-network-tui
- run system-config-network-tui
- manually edit /etc/sysconfig/network-scripts/ifcfg-eth0
@kennwhite
kennwhite / otrdm.md
Created October 19, 2015 23:19 — forked from colinmahns/otrdm.md
HOWTO: Twitter DM with OTR

Twitter DM + OTR: A quick and dirty tutorial

With the recent removal of the 140-character limit in Direct Messages by Twitter, DM's have now become a much more useful platform for communicating between individuals and groups. Sadly, DM's are still sent in plaintext between users and Twitter has no plans currently on encrypting these messages, at least as of August 2015. Since these are stored in plaintext at rest, an adversary can see the content of the message you are sending, which the two parties might not wish to happen. Fortunately as a few applications with basic Twitter support which also have excellent support for OTR, all hope isn't lo

package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@kennwhite
kennwhite / gist:11159f9e1252cc9ba338
Created November 16, 2015 14:52 — forked from iwinux/gist:5578188
Go's html/template with better subdirectory support.
package templates
import(
"html/template"
"io"
"os"
"strings"
"path/filepath"
)
@kennwhite
kennwhite / gist:ed0fcdbb6af10afa0f03
Created November 30, 2015 17:24 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@kennwhite
kennwhite / trim_enabler.sh
Last active December 21, 2015 05:18 — forked from return1/trim_enabler.txt
Enable SSD Trim support on Mac Lion & Mountain Lion. Original version by Grant Parnell.
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
# And here: http://forums.macrumors.com/showthread.php?t=1480302
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
# for Mountain Lion 10.8.3 - 10.8.4
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.1-10.8.2 and Lion 10.7.5
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x51)|
@kennwhite
kennwhite / letsencrypt-renew.sh
Created January 15, 2016 16:07 — forked from jcjones/letsencrypt-renew.sh
Cron script to renew Let's Encrypt certs using the official client
#!/bin/bash
# This is free and unencumbered software released into the public domain.
#
# This script is designed to be run daily by cron. Please run it with randomness in its timing to
# avoid load spikes at Let's Encrypt. One example, running between midnight at 2 AM, would be:
#
# 0 0 * * * sleep $[(RANDOM % 115)+5]m ; /usr/sbin/letsencrypt-renew.sh
#
# If you aren't using Nginx, adjust the startServer and stopServer methods to suit. Also, you could
# use the webroot method.
@kennwhite
kennwhite / Better error handling
Created May 9, 2016 14:28 — forked from 4ydx/Better error handling
Wrapping multiple similar calls so that error handling code is reduced.
type WriteDB struct {
Conn *sql.DB
Err error
}
func (db *WriteDB) Do(
update,
title,
updated_at,
updated_by,
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048