Skip to content

Instantly share code, notes, and snippets.

View stackdump's full-sized avatar

stackdump stackdump

View GitHub Profile
vagrant@vagrant:~$ reddit-shell
Overriding g.--plugin to r2
vagrant:5501 started 44e4803 at 20:43:13 (took 1.14s)
Traceback (most recent call last):
File "/usr/bin/paster", line 4, in <module>
command.run()
File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
@stackdump
stackdump / metaclass-black-magic
Last active August 29, 2015 14:08
metaclass / DSL + inheritance
require 'pp'
module Base
def metaclass
class << self
self
end
end
def p_r
http {
# enable reverse proxy
proxy_redirect off;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for;
upstream streaming_example_com
@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
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/usr/bin/env ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'