Skip to content

Instantly share code, notes, and snippets.

Nick Larson ifightcrime

Block or report user

Report or block ifightcrime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ifightcrime
ifightcrime / .bashrc
Created Mar 19, 2016 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
View .bashrc
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@ifightcrime
ifightcrime / 01_postfix_installer.md
Created Feb 14, 2016 — forked from solusipse/01_postfix_installer.md
Postfix + Dovecot + Postgresql + Postfixadmin + Roundcube
View 01_postfix_installer.md

Postfix Installer

Following script may be used for configuring complete and secure email server on fresh install of Debian 7. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.

Usage

  1. Run postfix.sh script.
  2. Configure postgres to allow connections.
  3. Configure postfix admin. Remember to set these:
@ifightcrime
ifightcrime / README.md
Last active Jan 21, 2016
Read, transform, and write a csv file
View README.md
@ifightcrime
ifightcrime / install_vbox_guest_additions.md
Last active Dec 11, 2015
Install VirtualBox Guest Additions (Linux)
View install_vbox_guest_additions.md

Devices > Install Guest Additions CD Image

mount /dev/sr0 /media/cdrom && cd /media/cdrom
./VBoxLinuxAdditions.run
@ifightcrime
ifightcrime / accept_nested_attributes.js
Last active Nov 3, 2015
FormBuilder addition for models that accept nested attributes.
View accept_nested_attributes.js
function addNestedRow(e) {
e.preventDefault();
// http://railscasts.com/episodes/197-nested-model-form-part-2
var html = $('#my-attribute-link-template').html();
var $attr_row = $(html.replace(/new_MyAttribute/g, new Date().getTime()));
$('#my-attributes').append($attr_row);
};
@ifightcrime
ifightcrime / random_password.rb
Created Sep 8, 2015
Safari like random passwords in ruby
View random_password.rb
BASE = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
def random_string(length = 3)
length.times.map { BASE[rand(BASE.length)] }.join
end
puts 4.times.map { random_string }.join('-')
@ifightcrime
ifightcrime / hash_dig.rb
Created Jul 14, 2015
"Dig" through hash using dot notation
View hash_dig.rb
class Hash
def dig(dotted_path)
parts = dotted_path.split '.', 2
first_part = parts[0]
match = self[first_part] || self[first_part.to_sym]
if !parts[1] || match.nil?
return match
else
return match.dig(parts[1])
end
@ifightcrime
ifightcrime / hashquiz.rb
Last active Aug 29, 2015 — forked from potatosalad/hashquiz.rb
Ruby quiz for convert hash "dot paths" into actual hash hierarchy.
View hashquiz.rb
#require 'rubygems'
require 'pp'
#require 'ap' # Awesome Print
class Object
# expects [ [ symbol, *args ], ... ]
def recursive_send(*args)
args.inject(self) { |obj, m| obj.send(m.shift, *m) }
end
end
View install_splunk.sh
#!/bin/bash
# Note: ensure credentials file is at /opt/splunkclouduf.spl first
# download latest Splunk forwarder
wget http://download.splunk.com/products/splunk/releases/6.2.1/universalforwarder/linux/splunkforwarder-6.2.1-245427-Linux-x86_64.tgz
# untar
tar -zxvf splunkforwarder-6.2.1-245427-Linux-x86_64.tgz
View wercker-nodejs-default.yml
box: wercker/nodejs
# Build definition
build:
# The steps that will be executed on build
steps:
# A step that executes `npm install` command
- npm-install
# A step that executes `npm test` command
- npm-test
You can’t perform that action at this time.