Skip to content

Instantly share code, notes, and snippets.


Mike Parks Karunamon

View GitHub Profile
Karunamon / tsocks.formula
Last active Dec 20, 2015
Mac Homebrew formula for Tsocks. No idea why this is unavailable where it's supposed to be...
View tsocks.formula
require 'formula'
class Tsocks < Formula
# The original is
# This GitHub repo is a maintained fork with OSX support
homepage ''
head ''
depends_on 'autoconf' => :build if MacOS.xcode_version.to_f >= 4.3
Karunamon / rpsafety.mrc
Last active Dec 26, 2015
RP Safety Script for mIRC
View rpsafety.mrc
;INSTRUCTIONS - Save as a file in your mIRC directory, and run //load -rs (the filename)
;follow on screen instructions
on *:LOAD: {
echo -a 9,1RP Safety v0.01 by Necoco/TKWare Loaded.
echo -a 9,1Please make sure you specify the channel you wish to rp in with /rpset (channel).
/set %rpsafetyon 0
alias rpset {
Karunamon / string_ranges.rb
Last active Dec 31, 2015
A monkey patch to return enumerable ranges from arbitrary strings
View string_ranges.rb
class String
def to_r
a = self.partition(/\(.+?\)/)
fail "No range in string" if a[0].empty?
fail "Invalid range #{a}" if { |v| v.match(/[A-Za-z]/) }
eval a[1]
def to_r_leading_zero
a = self.partition(/\(.+?\)/)
View gist:8062851
If you want, I can try and help with pointers as to how to improve the indexing speed you get. Its quite easy to really increase it by using some simple guidelines, for example:
- Use create in the index API (assuming you can).
- Relax the real time aspect from 1 second to something a bit higher (index.engine.robin.refresh_interval).
- Increase the indexing buffer size (indices.memory.index_buffer_size), it defaults to the value 10% which is 10% of the heap.
- Increase the number of dirty operations that trigger automatic flush (so the translog won't get really big, even though its FS based) by setting index.translog.flush_threshold (defaults to 5000).
- Increase the memory allocated to elasticsearch node. By default its 1g.
- Start with a lower replica count (even 0), and then once the bulk loading is done, increate it to the value you want it to be using the update_settings API. This will improve things as possibly less shards will be allocated to each machine.
- Increase the number of machines you have so
Karunamon /
Created Dec 30, 2013
SSH tunnel setup script. Source in your profile for awesomeness.
function proxtun(){
#Validity check of settings
if [ ! -e ~/.proxtun ]; then
echo "No proxy user/host set. Please set up a remote machine with SSH"
echo "tunneling capability (with keys) and then put that user@host in"
echo "~/.proxtun"
return 5
tunhost=`cat ~/.proxtun`
Karunamon / gist:9218604
Last active Aug 29, 2015
Keybase proof
View gist:9218604
### Keybase proof
I hereby claim:
* I am karunamon on github.
* I am mparks ( on keybase.
* I have a public key whose fingerprint is 941B F3C3 0864 E10C F14C 6BBF B553 9BD4 1632 3550
To claim this, I am signing this object:
Karunamon / conf_cli_add_datefields.rb
Created Mar 3, 2014
Appends month/day/year fields to CSV files - useful because you apparently can't target blog entries by title in Confluence CLI without specifying their date separately.
View conf_cli_add_datefields.rb
#!/usr/bin/env ruby
#Add date fields for mass operations on blogs with Atlassian CLI.
require "csv"
fail "Specify path to input file" unless ARGV[0]
fail "Specify path to output file" unless ARGV[1]
hdr=true[1], 'w') do |csv|
CSV.foreach(ARGV[0], :headers => true, :skip_blanks => true) do |row|
date = row["Created"].match(/(?<month>\d+)\/(?<day>\d+)\/(?<year>\d+)/)
View distribute_ssh_keys.rb
#!/usr/bin/env ruby
# distribute_ssh_keys.rb
# Jason Boxman <>
# 20110624
# From
# Unsure of the license on this. Tread carefully.
# Sanely deploy ssh public key to multiple hosts.
# Tomcat 7 start/stop/status script
# Forked from:
# @author: Miglen Evlogiev <>
# Release updates:
# Updated method for gathering pid of the current proccess
# Added usage of CATALINA_BASE
# Added coloring and additional status
Karunamon /
Last active Aug 29, 2015
Shell script integrity verification
#!/usr/bin/env bash
#Add this function to any shell script. You require a HTTP(preferrably HTTPS)
#server to serve up a .asc file named identically to your script. Your public key
#must also be installed on the server. Requires curl and gpg.
#To generate the signature file: gpg -a --detach-sig <script filename>
base=$(basename $0)
temp=`mktemp /tmp/$(basename $0).XXXXX`
curl -sS http://someserver/$base.asc -o $temp >/dev/null 2>&1