Skip to content

Instantly share code, notes, and snippets.

View huned's full-sized avatar
💭
I may be slow to respond.

Huned Botee huned

💭
I may be slow to respond.
View GitHub Profile
@huned
huned / id_rsa.pub
Created August 26, 2015 17:21
hbotee@adaptiveinsights.com ssh public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDTdgHCHb47Iq6VI5h/LXkr4huTrRkgc4t72soFL9/ZZJ+pj+NlHOtSd43QPKpMXpuIRk2DEfQ01UaGImcYxRGPaym1/z6TOANLl7qIAtX5noZK6BdFML0HqI/pVYNqLZqN0pela8AzZjZFEsZpr7eHvNO0WWHrcyJbGY+8eiamQ7tFO9i611oVQpVvfFdW5PM8ISzWpJL1Jqf3csDgBd+4KDSl4dKrwT1fZkGCz6wKOXlpm6uf+UDfqegNPz5XKmSkVdeBopRCnXnACRMaPyK5vwbDyzqllK4A0FL3blLvT185kECe5wIq2T/QtjLVN4HsnkbtNFcmk2GSOhNUI63 hbotee@adaptiveinsights.com
@huned
huned / -
Created March 23, 2014 01:14
# <%= hostname %>
#
# Serves a Rails app via SSL. If nginx finds a rule to handle the request, use
# it; unhandled requests are proxied upstream to a puma server.
#
# Notes:
#
# * Assumes SSL. Non-SSL requests are redirected to their SSL equivalents.
# * Assumes SSL certificate and key at ...
# * Assumes that rails app is served via puma at ...
SELECT
j1.name AS parent_node_id ,
j2.name AS child_node_id ,
scenario_id ,
measure ,
value ,
revised_at ,
effective_at
FROM
edge_properties t1
=> meow!
/\___/\
__m_( . . )_m__
set :rails_env, :production
set :unicorn_binary, "/usr/bin/unicorn"
set :unicorn_config, "#{current_path}/config/unicorn.rb"
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
require File.expand_path('../../config/environment', __FILE__)
require 'csv'
intermediaries = Person.intermediary.asc(:name).to_a
intermediaries.each do |person|
company = person.current_company
latest_activity =
if company.present?
company.activities.desc(:created_at).where(:kind.in => Activity::FOLLOWUPABLE_KINDS).first
else
@huned
huned / activeresource_base_callable_user.rb
Created September 5, 2014 20:57
Monkey patch ActiveResource::Base.user so that it calls @user if user is callable, otherwise uses the default behavior.
module ActiveResource
class Base
class << self
# Monkey patch ActiveResource::Base.user a little. We want it to call
# @user if @user is callable, otherwise use the default behavior.
def user_with_lambda
if defined?(@user) && @user.respond_to?(:call)
@user.call(self)
else
user_without_lambda # default behavior
@huned
huned / id_dsa.pub
Last active August 29, 2015 14:10
huned@omg's public key
ssh-dss AAAAB3NzaC1kc3MAAACBAIE9R4sFArK2lrn0l0MLRFxn0ExUMIH/4VPg2gQxE9a1KwTr9nbQpL6H+mxxZLNm9+iKZeKrx+PEqNH6SmhYx0LUQ7FqaYhy89Leoy5uUW87CSd9x7KuxBChK9vvqyf8X7b2mGzWgs5XRzSiLHngn8XGHxVgXQoS1K/w7M+c4I2nAAAAFQDEhsSJQOzio1v8Jiy5ypALwxnaswAAAIB7STNNhWdkb7SeHs0zEEkwgs0nExzBFAZ3WAmZZnb8m9HWTLbwZpGGPRfcWi0cthHIwfzATvzUwEZuzjmeqhS9J7UxSaPOpzg4mTSQFvj6ZHzTg+ZwhNIRAOOaXV2lopq9KChV+ZSjtmZQDs6Js0oJEAuw5DCktKTnkZ1Kf8hsfQAAAIBattEuuohpFnTY5VM8B7mMVib1y1jQ0yPa+sORBFqzdGeJxoPZJvGXhO5L90KW20VtLGRbrrkdrZ75/7Cy1mISe6+Of7WBaZniL+kxUN4+hwuw/2aWjgOUstEhFOf3rilinMc/wBtCjpe5GLLEbDTGLAlZbS0/GwS+hh1GLKfdmg== huned@omg
#!/bin/sh
# Plot an ASCII histogram of numbers from stdin. Uses gnuplot.
# Optionally specify bin size as an argument.
if [ "$1" == '' ]; then
binsize=100
else
binsize=$1
fi
@huned
huned / random
Last active August 29, 2015 14:15
#!/bin/sh
# Generate n random numbers in [0, 999]. n defaults to 100 but override it with $1.
if [ "$1" == '' ]; then
upto=100
else
upto=$1
fi
for i in `seq 1 $upto`; do echo $(($RANDOM % 1000)); done