Skip to content

Instantly share code, notes, and snippets.

@dctrwatson
dctrwatson / graphite.wsgi
Last active December 15, 2015 18:39
Adding raven to graphite-web
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
from django.core.handlers.wsgi import WSGIHandler
application = Sentry(WSGIHandler())
@dctrwatson
dctrwatson / nginx.conf
Last active December 16, 2015 04:08
Caching Nginx Conf for Phabricator
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
nginx version: nginx/1.2.9
TLS SNI support enabled
configure arguments:
--prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-log-path=/var/log/nginx/access.log
--http-proxy-temp-path=/var/lib/nginx/proxy
@dctrwatson
dctrwatson / graphite_multi_index.sh
Created October 1, 2013 22:20
Combine multiple whisper dirs into single index
!/usr/bin/env bash
if [ $# -lt 1 ] ; then
echo "Need at least 1 whisper dir to index"
exit 1
fi
GRAPHITE_ROOT=${GRPHITE_ROOT:-"/opt/graphite"}
GRAPHITE_STORAGE_DIR=${GRAPHITE_STORAGE_DIR:-"${GRAPHITE_ROOT}/storage"}
@dctrwatson
dctrwatson / gist:7534890
Created November 18, 2013 20:38
Git stats commands
# Top longest messaages
git log --format='%h%x00%an%x00%s%x00%B%x1e' | gawk 'BEGIN { FS="\0" ; RS="\x1e\n" }{ print length($4), $1, "-", $2, "|", $3 }' | sort -rn | head
# Top average messages
git log --format='%ae%x00%B%x1e' | gawk 'BEGIN { FS="\0" ; RS="\x1e\n" ; }{ sums[$1] += length($2) } END { for (i in sums) printf("%s %s\n", sums[i], i) }' | sort -rn | head
@dctrwatson
dctrwatson / gist:7763943
Created December 3, 2013 04:37
RAID adapter blocking due to a dead drive causing issues with Cassandra and pycassa
[21174748.746874] INFO: task jsvc:9672 blocked for more than 120 seconds.
[21174748.749104] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[21174748.751489] jsvc D ffffffff81806240 0 9672 9639 0x00000000
[21174748.751497] ffff8803436abe08 0000000000000082 ffff8800850bd000 ffffffffffffff98
[21174748.751516] ffff8803436abfd8 ffff8803436abfd8 ffff8803436abfd8 00000000000137c0
[21174748.751534] ffff88032bf39700 ffff8805fe535c00 ffff880622cf40c0 ffff8805fe535c00
[21174748.751553] Call Trace:
[21174748.751563] [<ffffffff8165ba6f>] schedule+0x3f/0x60
[21174748.751573] [<ffffffff8165d86d>] rwsem_down_failed_common+0xcd/0x170
[21174748.751583] [<ffffffff8165d923>] rwsem_down_write_failed+0x13/0x20
@dctrwatson
dctrwatson / OpenSSL 0.9.8x
Created July 31, 2013 08:45
Difference between OpenSSL versions System Version: OS X 10.8.4 (12E55) Kernel Version: Darwin 12.4.0 Model Name: MacBook Pro Model Identifier: MacBookPro10,2 Processor Name: Intel Core i7 Processor Speed: 2.9 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 4 MB Memory: 8 GB
OpenSSL 0.9.8x 10 May 2012
built on: Apr 27 2013
options:bn(64,64) md2(int) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr2)
compiler: -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DMD32_REG_T=int -DOPENSSL_NO_IDEA -DOPENSSL_PIC -DOPENSSL_THREADS -DZLIB -mmacosx-version-min=10.6
available timing options: TIMEB USE_TOD HZ=100 [sysconf value]
timing function used: getrusage
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
md5 38143.69k 119545.89k 277327.98k 421224.64k 490718.66k
hmac(md5) 44242.06k 134438.19k 293790.30k 422019.19k 494423.98k
@dctrwatson
dctrwatson / gist:7206322
Last active February 12, 2018 14:30
Jank way to use instance storage automatically in EC2
#cloud-config
mounts:
- [ ephemeral0, /var, ext4, "defaults,noatime", "0", "2" ]
- [ swap, null ]
bootcmd:
- mkdir -p /tmp/root
- mount --bind / /tmp/root
- rsync -aq /tmp/root/var/lib/cloud /var/lib/
@dctrwatson
dctrwatson / README.md
Last active June 21, 2019 23:51
Open Network Config for Mullvad OpenVPN

Natively connect to Mullvad OpenVPN servers with ChromeOS.

Usage

  1. Download the example ONC file
  2. Open the file with Text and update Username with your account number
  3. Open chrome://net-internals/#chromeos
  4. Import the ONC file

Tip

set runtimepath+=$GOROOT/misc/vim
set runtimepath+=$HOME/gocode/src/github.com/golang/lint/misc/vim
" Enable filetype plugin
filetype on
filetype plugin on
filetype plugin indent on
syntax on " Syntax highlighting