Skip to content

Instantly share code, notes, and snippets.

View warmans's full-sized avatar

SW warmans

  • Nottingham
View GitHub Profile
#!/bin/env python
import time
import RTk.GPIO as GPIO
import openvr
import sys
import atexit
def shutdown():
@warmans
warmans / gist:8247a71d06ee33e6fc20
Created May 16, 2015 07:55
Ubuntu 15.04 Macbook Pro 2015 Fixes

Fonts missing after suspend

Create a new file in /usr/share/X11/xorg.conf.d called 52-suspend-fix.conf

Section "Device"
        Identifier "intel"
        Driver "intel"
        Option "AccelMethod" "none"
EndSection
@warmans
warmans / gist:8c31948fdb2b23127e08
Last active August 29, 2015 14:20
Decode cassandra thrift message with PHP and tcpdump
  1. Capture some data using tcpdump:

    tcpdump -enx -w cassandra-dump port 9160

  2. Open the file with wireshark and find a packet where the data looks related to casandra e.g. it has multiget_slice or similar commands near the start of the data.

  3. In wireshark select the data part of the packet and right click -> copy -> bytes -> hex stream

  4. Now you need a thrift library to decode the data. thobbs/phpcassa should work.

while true; do inotifywait -qr --format '%w' *.go | while read FILE; do echo $FILE; gofmt -w $FILE; done; done;
@warmans
warmans / gist:d2b7e0577bc8aa87919a
Created April 9, 2015 21:58
Run command each time a file in a given dir changes
while true; do inotifywait -re modify [dirname] && echo "DO SOMETHING"; done;
@warmans
warmans / gist:292b2632c8a98f925954
Last active August 29, 2015 14:17
Cassandra Useful Commands
# Show the latency across keyspaces
nodetool cfstats | grep "Latency"
# Identify how many replicas have a row
# 1. use cassandra-cli to identify row key (connect <host>/<port>; use <keyspace>; list <table> limit 1;)
# 2. copy key into: nodetool getendpoints -- <keyspace> <table> <key>
#Node Exceptions
nodetool info | grep Exceptions
@warmans
warmans / gist:03e8ebd178b5e94fd7c7
Created January 27, 2015 20:49
Centos jstatd init script
#!/bin/sh
# jstatd - runs the jstat daemon
#
# chkconfig: - 85 15
# description: Jstatd JVM monitoring
# processname: jstatd
# pidfile: /var/run/jstatd.pid
# Source function library.
. /etc/rc.d/init.d/functions
@warmans
warmans / gist:d3ac9f57e6daa71d1606
Last active August 29, 2015 14:14
cassandra GC log tail chart
#$4*10 alters the scale so if you set 10*100 each segment of a bar would be 1 100th of a second
tail -f /var/log/cassandra/gc.log.0 | while read line; do echo $line | head -c $(awk '{ print int($4*10) }') </dev/zero | tr '\0' '='; printf "|\n"; done
while(true) do out=$(./vendor/bin/phpunit); clear; echo -e "$(date)" "\n" "$out"; done
@warmans
warmans / doxy.conf
Created November 6, 2014 22:59
doxy callgraph config
# Doxyfile 1.7.6.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]