Skip to content

Instantly share code, notes, and snippets.

View jamesmoriarty's full-sized avatar
🔮
0xc0000005

James Moriarty jamesmoriarty

🔮
0xc0000005
View GitHub Profile
ls --almost-all | head --lines=-1 | xargs rm -r
@jamesmoriarty
jamesmoriarty / Vagrantfile
Created September 27, 2014 05:18
Vagrant, Ansible, Rbenv and Ruby on Rails
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.box = "precise"
#!/usr/bin/env ruby
#
# Syncs Ruby binstubs for ruby-communal-gems.
# Run this everytime you install a new Ruby, or when you install a new gem
# with a bin/ command. (ie, when you typically do rbenv rehash)
#
# See: https://github.com/tpope/rbenv-communal-gems/issues/5
#
require 'fileutils'
### Keybase proof
I hereby claim:
* I am jamesmoriarty on github.
* I am jamesmoriarty (https://keybase.io/jamesmoriarty) on keybase.
* I have a public key whose fingerprint is 06A1 9318 4CA2 F3A0 BDA4 1B17 0062 ED6D CBAF BEEF
To claim this, I am signing this object:
1. go to http://dl.hhvm.com/ubuntu/pool/main/h/hhvm/ and right click and copy the link to the version of hhvm you want to rollback to
2. sudo apt-get autoremove hhvm -y
3. wget <link you just copied>
4. sudo dpkg -i <name of file u just downloaded>
5. apt-get install -f
6. service hhvm start
Edit: Don't worry when it errors out on step 4. that is expected. just continue to step 5.
@jamesmoriarty
jamesmoriarty / vpn_assigned_dns_overide.rb
Created December 22, 2010 08:29
Vpn assigned dns override script.
#!/usr/bin/env ruby
require 'pty'
require 'optparse'
unless ENV['USER'].eql?("root")
puts "Must be run as root.\nFailed."
exit
end
options = {}
@jamesmoriarty
jamesmoriarty / threading_cpu_bound.rb
Created December 22, 2010 08:31
Cpu bound task threading benchmark.
require 'benchmark'
N_OPS = 100_000_000
N_THREADS = 10
BM_LABEL_WIDTH = 15
def func(n_ops)
(1..n_ops).each { 1 + 1 }
end
before "newrelic:server_monitor:install", "newrelic:server_monitor:uninstall"
namespace :newrelic do
namespace :server_monitor do
task :install, :roles => :web do
run "curl -o ~/newrelic-sysmond-1.1.2.124-linux.tar.gz http://download.newrelic.com/server_monitor/release/newrelic-sysmond-1.1.2.124-linux.tar.gz"
run "tar xzvf ~/newrelic-sysmond-1.1.2.124-linux.tar.gz"
sudo "cp ~/newrelic-sysmond-1.1.2.124-linux/daemon/nrsysmond.x64 /usr/local/bin/nrsysmond"
sudo "cp ~/newrelic-sysmond-1.1.2.124-linux/scripts/nrsysmond-config /usr/local/bin"
sudo "mkdir -p /etc/newrelic /var/log/newrelic"
sudo "chmod 1777 /etc/newrelic /var/log/newrelic"
@jamesmoriarty
jamesmoriarty / .bash_profile
Created March 5, 2012 01:41
git branch name in prompt
##
# Bash customizations
##
export CLICOLOR=1 # Enable color shell
export LSCOLORS=ExFxCxDxBxegedabagacad # Define colors
export COLOR_RED="\e[0;31m"
export COLOR_PINK="\e[35;1m"
export COLOR_NORMAL="\e[m"
command W w !sudo tee % > /dev/null