Skip to content

Instantly share code, notes, and snippets.

# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@kennwhite
kennwhite / gist:1d60ff622248d725f1de
Last active August 29, 2015 14:07 — forked from tedder/gist:0d3276040054eb10857b
Tedder's ELB Security Policy
PolicyDescriptions:
- PolicyName: ELBSecurityPolicy-2014-10
PolicyTypeName: SSLNegotiationPolicyType
PolicyAttributeDescriptions:
- AttributeName: Protocol-SSLv2
AttributeValue: false # http://en.wikipedia.org/wiki/Transport_Layer_Security#SSL_2.0
- AttributeName: Protocol-TLSv1
AttributeValue: true # generally recognized as safe
- AttributeName: Protocol-SSLv3
AttributeValue: false # POODLE, https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566
#!/bin/bash
# bin/elb-describe-lbs | awk '{print $2}' | xargs -n1 elb-set-secure-policy.sh
ELB=$1
echo "Setting Policy on Load Balancer $1"
bin/elb-create-lb-policy $ELB \
--policy-type SSLNegotiationPolicyType \
--policy-name elb-secure-ssl \
@kennwhite
kennwhite / rc4.js
Last active August 29, 2015 14:08 — forked from dchest/rc4.js
function rc4(f,F,g,G){for(var U=256,b=[],c=a=0,d;U>a;a++)b[a]=a;for(a=0;U>a;a++)c=(c+b[a]+f[a%F])%U,d=b[a],b[a]=b[c],b[c]=d;for(var e=c=a=0;e<G;e++)a++,a%=U,c+=b[a],c%=U,d=b[a],b[a]=b[c],b[c]=d,g[e]=b[(b[a]+b[c])%U]}
// Usage:
//
var key = [75, 101, 121]; // input bytes: "Key"
var out = new Array(10); // place for keystream bytes
rc4(key, key.length, out, out.length); // out now contains keystream: [235, 159, 119, 129, 183, 52, 202, 114, 167, 25]
@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
#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
local name=$(basename "$0")
@kennwhite
kennwhite / otrdm.md
Created October 19, 2015 23:19 — forked from cmahns/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