Skip to content

Instantly share code, notes, and snippets.

View OpenCoderX's full-sized avatar
💭
Open to new projects

OpenCoderX OpenCoderX

💭
Open to new projects
View GitHub Profile
@bdotdub
bdotdub / redis.markdown
Created November 24, 2010 22:18
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@mislav
mislav / gist:938183
Created April 23, 2011 02:28
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
@ianmurrays
ianmurrays / deploy.rb
Created July 21, 2011 17:26
Runs test locally before deploying on capistrano.
set :test_log, "logs/capistrano.test.log"
namespace :deploy do
before 'deploy:update_code' do
puts "--> Running tests, please wait ..."
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null'
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong."
exit
else
puts "--> Tests passed"
@quinn
quinn / ubuntu-neo4j.sh
Created October 23, 2011 16:33
neo4j on ubuntu
sudo apt-get install openjdk-6-jre-headless
curl -O http://dist.neo4j.org/neo4j-community-1.5.M02-unix.tar.gz
tar -xf neo4j-community-1.5.M02-unix.tar.gz
rm neo4j-community-1.5.M02-unix.tar.gz
neo4j-community-1.5.M02/bin/neo4j start
@OpenCoderX
OpenCoderX / latency.txt
Created May 31, 2012 12:56 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns || 5.0 × 10^-10 seconds
Branch mispredict 5 ns || 5.0 × 10^-9 seconds
L2 cache reference 7 ns || 7.0 × 10^-9 seconds
Mutex lock/unlock 25 ns || 2.5 × 10^-8 seconds
Main memory reference 100 ns || 1.0 × 10^-7 seconds
Compress 1K bytes with Zippy 3,000 ns || 3.0 × 10^-6 seconds
Send 2K bytes over 1 Gbps network 20,000 ns || 2.0 × 10^-5 seconds
Read 1 MB sequentially from memory 250,000 ns || 0.00025 seconds
Round trip within same datacenter 500,000 ns || 0.00050 seconds
Disk seek 10,000,000 ns || 0.01 seconds
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 22, 2024 23:19
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
class ETLJob
include Sidekiq::Worker
sidekiq_options :queue => :ETLTasks, :backtrace => true, :retry => false
def perform(control_file)
ETL::Engine.init({:execution_dbname=>"etl_execution_prod"})
ETL::Engine.process("#{Dir.pwd}/control/#{control_file}.ctl")
end
end
@andreasronge
andreasronge / show.rb
Created April 22, 2013 07:34
Working with relstionships
require 'neo4j'
class Show < Neo4j::Rails::Model
property :show_name, type: String, index: :exact
has_n :booked_bands
end
#I have another model, band.rb
class Band < Neo4j::Rails::Model
@GEOFBOT
GEOFBOT / flink.service
Created July 19, 2016 15:11
systemd file for flink