Skip to content

Instantly share code, notes, and snippets.

View Karunamon's full-sized avatar

Mike Parks Karunamon

View GitHub Profile
@Karunamon
Karunamon / ssh_tunnel.sh
Created December 30, 2013 15:19
SSH tunnel setup script. Source in your profile for awesomeness.
#!/bin/bash
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
fi
tunhost=`cat ~/.proxtun`
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
Karunamon / string_ranges.rb
Last active December 31, 2015 23:49
A monkey patch to return enumerable ranges from arbitrary strings
class String
def to_r
a = self.partition(/\(.+?\)/)
fail "No range in string" if a[0].empty?
fail "Invalid range #{a}" if a.select { |v| v.match(/[A-Za-z]/) }
eval a[1]
end
def to_r_leading_zero
a = self.partition(/\(.+?\)/)
@Karunamon
Karunamon / rpsafety.mrc
Last active December 26, 2015 14:29
RP Safety Script for mIRC
;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
Karunamon / tsocks.formula
Last active December 20, 2015 04:29
Mac Homebrew formula for Tsocks. No idea why this is unavailable where it's supposed to be...
require 'formula'
class Tsocks < Formula
# The original is http://tsocks.sourceforge.net/
# This GitHub repo is a maintained fork with OSX support
homepage 'http://github.com/pc/tsocks'
head 'https://github.com/pc/tsocks.git'
depends_on 'autoconf' => :build if MacOS.xcode_version.to_f >= 4.3