Skip to content

Instantly share code, notes, and snippets.

@rebyn
rebyn / aws-auth-cm.sh
Created March 4, 2020 15:07 — forked from pmatv/aws-auth-cm.sh
Map IAM group to EKS ConfigMap
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IAM_GROUP=${1:-admins}
EKS_ROLE_ARN=${2:-arn:aws:iam::111122223333:role/eks-node-role}
RBAC_GROUP=${3:-system:masters}
@rebyn
rebyn / large_redshift_tables.sql
Created July 19, 2016 15:50 — forked from subelsky/large_redshift_tables.sql
Quick SQL command to find large tables in redshift
-- based on http://stackoverflow.com/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes"
FROM stv_blocklist
INNER JOIN
(SELECT DISTINCT id, name FROM stv_tbl_perm) names
ON names.id = stv_blocklist.tbl
GROUP BY name
ORDER BY "Size in Gigabytes" DESC
@rebyn
rebyn / install.sh
Created February 29, 2016 10:01 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@rebyn
rebyn / progress_bar.rb
Created January 2, 2016 18:10 — forked from kuntoaji/progress_bar.rb
Simple progress bar script without Gem using Ruby.
#!/usr/bin/env ruby
progress = 'Progress ['
1000.times do |i|
# i is number from 0-999
j = i + 1
# add 1 percent every 10 times
if j % 10 == 0
defaults: &defaults
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
user: admin
password: password
development:
<<: *defaults
@rebyn
rebyn / require.rb
Last active December 18, 2015 17:49
irb: Require .rb file in current directory
$ irb
>> require './file_to_be_used' #without .rb
=> true
@rebyn
rebyn / gist:5795585
Created June 17, 2013 08:58
use Active Support in irb
Came across a case today in which I had to use a few Active Support's methods. Here's how:
$ irb
> require 'active_support'
> ActiveSupport::Inflector.singularize('inflections')
> ActiveSupport::Inflector.humanize('humanize_me')
@rebyn
rebyn / ember-resources.md
Last active December 16, 2015 04:18
Ember.js resources to get started

Coming from Rails background (which seems traditional and old schooled in this case), I find Javascript frameworks highly confusing. After navigating a bit around, these resources prove to be really helpful for entry learners like me. So I compiled them together in this list. Feel free to suggest more in the comments!

Love At First Sight

Getting Into Ember.js

@rebyn
rebyn / cmd.sh
Created December 7, 2015 17:13 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@rebyn
rebyn / bkadb-data-gen.sh
Created December 5, 2015 21:25 — forked from cmerrick/bkadb-data-gen.sh
Better Know a Database - Redshift Load Data Formats
#!/bin/sh
# OS: Ubuntu 14.01
# Generate data - produces about 200GB on disk, takes a while
DATADIR=tpch-dbgen
SCALE=1000
git clone https://github.com/electrum/tpch-dbgen.git
cd $DATADIR && make && ./dbgen -f -v -C 16 -S 1 -s $SCALE && cd -