Skip to content

Instantly share code, notes, and snippets.

View dstokes's full-sized avatar

Drew Stokes dstokes

View GitHub Profile
@suprememoocow
suprememoocow / install.sh
Created April 7, 2014 22:33
Update OpenSSL to 1.0.1g using Ansible
#!/bin/bash
# roles/openssl/files/install.sh
wget https://www.openssl.org/source/openssl-1.0.1g.tar.gz -O /tmp/openssl-1.0.1g.tar.gz
cd /tmp
tar -xvzf openssl-1.0.1g.tar.gz
cd openssl-1.0.1g
@UtahDave
UtahDave / master config snippet
Created May 30, 2014 17:11
Example of using Salt Environments to only use _grains in the base environment.
file_roots:
base:
- /srv/salt/default_states
- /srv/salt/aws_stuff
vagrant:
- /srv/salt/default_states
Then place your aws specific custom grains in /srv/salt/aws_stuff/_grains
@d48
d48 / loud.coffee
Last active December 28, 2015 08:49
loudbot.coffee
# Description:
# Display a random tweet from loudbot if someone YELLS in chat
#
# Dependencies:
# "ntwitter" : "https://github.com/sebhildebrandt/ntwitter/tarball/master",
#
# Configuration:
# HUBOT_TWITTER_CONSUMER_KEY
# HUBOT_TWITTER_CONSUMER_SECRET
# HUBOT_TWITTER_ACCESS_TOKEN_KEY
@creationix
creationix / app.js
Last active December 30, 2015 07:29
Generate a tree of events using process.addAsyncListener
var http = require('http');
var send = require('send');
var urlParse = require('url').parse;
var count = 2;
var server = http.createServer(function (req, res) {
if (!--count) server.close(); // Only allow two connection and then exit.
send(req, urlParse(req.url).pathname)
.root(__dirname)
.pipe(res);

build

Clone and build Node for analysis:

$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4
@rnewson
rnewson / haproxy.cfg
Last active November 18, 2021 22:12
haproxy.cfg stanzas to enable Perfect Forward Secrecy and HTTP Strict Transport Security. Requires OpenSSL 1.0.1g or so.
# Bind SSL port with PFS-enabling cipher suite
bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:!MD5:!aNULL:!DH:!RC4
# Distinguish between secure and insecure requests
acl secure dst_port eq 443
# Mark all cookies as secure if sent over SSL
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure
# Add the HSTS header with a 1 year max-age
@jzawodn
jzawodn / wait.sh
Created November 21, 2008 15:13
how to wait on multiple background processes and check exit status in bash
#!/bin/bash
FAIL=0
echo "starting"
./sleeper 2 0 &
./sleeper 2 1 &
./sleeper 3 0 &
./sleeper 2 0 &
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active December 24, 2023 05:25
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
#!/usr/bin/env bash
size=1024 # MB
mount_point=$HOME/tmp
name=$(basename "$mount_point")
usage() {
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \
"(default: mount)" >&2
}