Skip to content

Instantly share code, notes, and snippets.

View h0lyalg0rithm's full-sized avatar

Suraj Shirvankar h0lyalg0rithm

View GitHub Profile
@h0lyalg0rithm
h0lyalg0rithm / database.sql
Last active August 29, 2015 14:26
PostgreSQL benchmark
CREATE TABLE test (
id serial NOT NULL primary key,
name text
desc1 text
desc2 text
);
CREATE INDEX alll ON test(name, desc1, desc2);
CREATE INDEX name ON test(name);
CREATE INDEX more ON test(name, desc1);
CREATE INDEX more1 ON test(name, desc2);
@h0lyalg0rithm
h0lyalg0rithm / keyboard-int.sh
Created August 7, 2015 21:18
Keyboard Maestro Task
osascript -e 'tell application "Keyboard Maestro Engine" to do script "Keyboard International"'
--color
--require spec_helper
def do_job
return if @cleaning
puts "Starting cleanup"
@cleaning = true
sleep(10) # simulate killing of sinatra app
puts "Completed"
exit
end
while true
trap('INT') { do_job }
@h0lyalg0rithm
h0lyalg0rithm / equality.rb
Last active August 29, 2015 14:13
Ruby equality
van_glory = Game.new title: ‘Van Glory’
fates = Game.new title: ‘Fates Forever’
van_gloryless = Game.new title: ‘Van Glory’
van_glory === van_glory # true
fates === van_glory # false
van_gloryless === van_glory # false
defmodule Factorial do
def factorial(n) when n>1 do
n * factorial(n-1)
end
def factorial(n) when n <=1 do
1
end
end
FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
COPY default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
@h0lyalg0rithm
h0lyalg0rithm / .htaccess
Created August 3, 2014 19:10
Routing example with Toro
FallbackResource /index.php
@h0lyalg0rithm
h0lyalg0rithm / twitter.rb
Last active August 29, 2015 14:01
Twitter gem
require 'twitter'
require 'unirest'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "CONSUMER KEY"
config.consumer_secret = "CONSUMER SECRET"
config.access_token_secret = "ACCESS TOKEN SECRET"
config.access_token = "ACCESS TOKEN"
end
@h0lyalg0rithm
h0lyalg0rithm / Cheffile
Last active August 29, 2015 14:01
Cheffile for lamp stack
# File Cheffile
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'apt'
cookbook 'php'
cookbook 'apache2'