Skip to content

Instantly share code, notes, and snippets.

View stackdump's full-sized avatar

stackdump stackdump

View GitHub Profile
@stackdump
stackdump / cpu_load.sh
Created January 27, 2015 21:36
bash script to max out cp load
#! /usr/bin/env bash
function cpuConsumingFunc {
echo 'worker started'
dd if=/dev/urandom | bzip2 -9 >> /dev/null;
}
function fulload {
x=0
while [ $x -lt $1 ]; do
@stackdump
stackdump / gpg-message.sh
Created February 20, 2015 17:20
encrypt a message
echo "hello world!" | gpg --no-default-keyring --keyring /tmp/gpg-$$ --encrypt --armor --auto-key-locate pka -r myork@stackdump.com
#
# INSTALLING GEPHI ON UBUNTU TRUSTY
#
# Edit the sources file and add this to end:
# deb http://ppa.launchpad.net/rockclimb/gephi-daily/ubuntu precise main
sudo joe /etc/apt/sources.list
# You can't just install gephi because it's missing libgoogle-collections-java
# And that one's not packaged with Ubuntu anymore as of Trusty at least
neo4j-sh (?)$ MATCH (p0:Page {title:'Neo4j'}), (p1:Page {title:'Kevin Bacon'}),
> p = shortestPath((p0)-[*..6]-(p1))
> RETURN p
> ;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| p |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| [Node[6831172]{title:"Neo4j"},:Link[83114204]{},Node[5350170]{title:"San Francisco Bay Area"},:Link[71148851]{},Node[327060]{title:"Barack Obama"},:Link[969118]{},Node[10735]{title:"Kevin Bacon"}] |
+-------------------------------------------------------------------------------------
# == Examples:
#
# class Post < ActiveRecord::Base
#
# include Sunspot::Document
#
# searchable do
# text :title
module Sunspot #:nodoc:
module Rails #:nodoc:
#
# This module adds Sunspot functionality to ActiveRecord models. As well as
# providing class and instance methods, it optionally adds lifecycle hooks
# to automatically add and remove models from the Solr index as they are
# created and destroyed.
#
module Searchable
class <<self
@stackdump
stackdump / .screenrc
Created May 5, 2016 03:20
screen config
startup_message off
defscrollback 20000
termcapinfo xterm ti@:te@
termcapinfo xterm-color ti@:te@
hardstatus alwayslastline
hardstatus string '%{gk}[%{G}%H%{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}]%{=b C}[%m/%d/%y %C %A]%{W}'
vbell off
#shell -$SHELL
logtstamp on
logtstamp after 1
@stackdump
stackdump / leap_machine.md
Last active March 10, 2017 08:43
A leap year counter state machine

Leap Year Counter

State Machine

StateMachine

So the events if you triggered them around the circle look like this (latest on top)

DROP TABLE octoe_events CASCADE;
DROP TABLE octoe_transitions CASCADE;
DROP TABLE octoe_states CASCADE;
DROP TYPE octoe_state CASCADE;
DROP TYPE octoe_vector CASCADE;
DROP TYPE octoe_event CASCADE;
DROP FUNCTION octoe_vclock();
DROP DOMAIN octoe_token CASCADE;
CREATE DOMAIN octoe_token as int4 CHECK(VALUE >= 0 and VALUE <= 65536);
@stackdump
stackdump / haproxy.cfg
Created June 30, 2017 15:15
haproxy template for ansible
global
log 127.0.0.1 local2
stats socket /etc/haproxy/haproxy.stat mode 777 level admin
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user root
group root
daemon