Skip to content

Instantly share code, notes, and snippets.

View rupurt's full-sized avatar
🏠
Working from home

Alex Kwiatkowski rupurt

🏠
Working from home
View GitHub Profile
@rupurt
rupurt / left_join_arel_example.rb
Created May 2, 2016 13:51 — forked from mildmojo/left_join_arel_example.rb
LEFT JOIN in ARel for ActiveRecord in Ruby on Rails
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of
# the mechanics, not a real-world use case.
# == DEFINITIONS
# - A Taxi is a car for hire. A taxi has_many :passengers.
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi.
class Taxi < ActiveRecord::Base
# This scope LEFT JOINs the Passenger table. You might use this if you wanted
# to select taxis by a set of taxi and passenger IDs (as with the
@rupurt
rupurt / host_and_connect.sh
Last active April 30, 2018 20:36
Host & Connect to tmux session
# Hoster
# Serveo
ssh -R 1500:localhost:22 serveo.net
# ngrok
ngrok tcp 22
# tmux
tmux -S /tmp/pair
chmod 777 /tmp/pair
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; sh test; } | nc -l 8080; done
#!/bin/bash
echo "************PRINT SOME TEXT***************\n"
echo "Hello World!!!"
echo "\n"
echo "Resources:"
vmstat -S M
@rupurt
rupurt / boltbrowser
Created April 10, 2018 17:02
GUI to navigate bolt databases
boltbrowser ~/.chainlink/db.bolt
@rupurt
rupurt / go_tests_with_fswatch.sh
Last active March 27, 2018 17:39
Run go tests on with fswatch
fswatch -0 -r -e ".*/4913" -e ".*/\.git/.*" . | tee /tmp/fswatch-changes | xargs -0 -n 1 -I {} richgo test ./...
@rupurt
rupurt / current-locks.sql
Created August 14, 2017 17:10
Current Postgres Locks
SELECT
pg_class.relname,
pg_locks.mode
FROM pg_locks
JOIN pg_class ON pg_class.oid = pg_locks.relation
ORDER BY mode ASC;
DROP TABLE IF EXISTS test;
CREATE TABLE test();
CREATE OR REPLACE FUNCTION dummy_tg() RETURNS TRIGGER
LANGUAGE plpgsql AS $$ BEGIN END; $$;
BEGIN;
CREATE TRIGGER blah BEFORE INSERT ON test FOR EACH ROW EXECUTE PROCEDURE dummy_tg();

Keybase proof

I hereby claim:

  • I am rupurt on github.
  • I am alexdk (https://keybase.io/alexdk) on keybase.
  • I have a public key ASACLJAL045gVMm5anwXZk29TYdLN84LM2BcA5Wy8BtDnwo

To claim this, I am signing this object:

def user_names
users.map { |u|
u.name
}
end
user_names = users.map { |u| u.name }
@rupurt
rupurt / copy_postgres_database.bash
Created August 29, 2016 16:34
Copy postgres database
createdb -O alex -T oldname newname