Skip to content

Instantly share code, notes, and snippets.

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

@radekg
radekg / .gitignore
Created November 28, 2014 23:11
EC2 IAM security credentials
.DS_Store
node_modules/*
@radekg
radekg / README.md
Last active August 29, 2015 14:07
List of contributors to a github project grouped by the company

List contributors

Output explained:

project_name contributors:
 --------------------------- 
Company name (if set on user profile)
  Member
  Member

Member

# ================================================================================
# ObjectStorageUploader.sh
# © Copyright IBM Corporation 2014.
# LICENSE: MIT (http://opensource.org/licenses/MIT)
# ================================================================================
import argparse
import os
import math
import http.client

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@radekg
radekg / generate_cassandra_tokens.rb
Last active December 17, 2015 21:59
Generate Cassandra tokens in Ruby.
nodes = 5
for x in Range.new(0,nodes,false)
token = 2 ** 127 / nodes * x
puts "Initial token: #{token}"
end
@radekg
radekg / ec_iam_security_credentials.js
Last active December 17, 2015 19:39
Fetch security credentials from EC2 API for nodes with IAM role set.
/*
Author:: Rad Gruchalski (<radek@gruchalski.com>)
The MIT License (MIT)
Copyright (c) 2013 Rad Gruchalski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@radekg
radekg / gist:4243613
Created December 9, 2012 06:34
Backup all github repos from all organisations we are assigned to and put on S3 (node.js)
var https = require("https")
, fs = require("fs")
, spawn = require('child_process').spawn
, AWS = require('aws-sdk');
var CONFIG = {
username: "<github-username>"
, password: "<github-password>"
, backupdir: "/where/to"
, bucket: "github.backup"
-module(lb).
-compile(export_all).
-include_lib("stdlib/include/qlc.hrl").
-include_lib("kernel/include/inet.hrl").
start_lb() ->
{ok, Redis} = eredis:start_link(),
eredis:q(Redis, ["FLUSHALL" | []]),
spawn_link(?MODULE, loop0, [1883,Redis]),
spawn_link(?MODULE, loop1, [1884,Redis]).