Skip to content

Instantly share code, notes, and snippets.

View dangerousbeans's full-sized avatar

Joran Kikke dangerousbeans

View GitHub Profile
@dangerousbeans
dangerousbeans / gist:8915436
Created February 10, 2014 12:57
Sublime Settings of Glory and Valour
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"soda_folder_icons": true,
"sublimelinter": true,
"tab_size": 2,
salt-ssh 'test1' test.ping --passwd DUCKDUCKDUCK --priv ~/.ssh/id_rsa
[WARNING ] Warning: sshpass is not present, so password-based authentication is not available.
test1:
ERROR: sudo expected a password, NOPASSWD required
@dangerousbeans
dangerousbeans / sublime_3_prefs.json
Created August 12, 2013 10:39
Sublime Text 3 Prefs
{
// The number of spaces a tab is considered equal to
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"ignored_packages":
[
@dangerousbeans
dangerousbeans / riemann.config.clj
Last active December 20, 2015 08:59
Riemann Config of Greatness
; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init :file "/var/log/riemann/riemann.log")
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "0.0.0.0"]
(tcp-server :host host)
require "rubygems"
require "amqp"
EventMachine.run do
connection = AMQP.connect(:host => '127.0.0.1')
channel = AMQP::Channel.new(connection)
low_queue = channel.queue("low")
high_queue = channel.queue("high")
exchange = channel.direct("")
@dangerousbeans
dangerousbeans / amqp_queue_worker.rb
Created June 5, 2013 10:43
Ruby AMQP Queue Priority
require "rubygems"
require "amqp"
EventMachine.run do
connection = AMQP.connect(:host => '127.0.0.1')
channel_low = AMQP::Channel.new(connection)
channel_high = AMQP::Channel.new(connection)
# Attempting to set the prefetch higher on the high priority queue
channel_low.prefetch(10)
@dangerousbeans
dangerousbeans / pg_greatest.rb
Last active December 17, 2015 08:49
Postgresql GREATEST squeel example
require 'squeel'
# Say a Farm has two integers to keep track of its stock and a constant to define what the minimum number of animals is
class Farm < ActiveRecord::Base
MIN_ANIMALS = 10
attr_accessible :kitten_count, :unicorn_count
end
# Now I want to bring back the largest count of animals for each farm, with the minimum value being MIN_ANIMALS incase both are below 10
Farm.select{ op('GREATEST', [kitten_count, unicorn_count, MIN_ANIMALS).as{ total_animal_count } }
@dangerousbeans
dangerousbeans / gist:5496332
Created May 1, 2013 16:23
Cloud service speedtest of greatness.
wget freevps.us/downloads/bench.sh -O - -o /dev/null|bash
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="tjkirch_mod"
# Example aliases
@dangerousbeans
dangerousbeans / .zshrc
Created February 15, 2013 12:23
.zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="tjkirch_mod"
# Example aliases