Skip to content

Instantly share code, notes, and snippets.

View cromulus's full-sized avatar

Bill Cromie cromulus

View GitHub Profile
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=42
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=43
else
local ansi=45
fi
@cromulus
cromulus / gist:c5d5e84b29ca7e47efee
Created July 7, 2014 13:49
Ethan's Ruby Warrior
class Player
attr_accessor :previous_health
def play_turn(warrior)
#warrior.walk!(:forward)
if warrior.health < 15 and warrior.feel.empty?
warrior.rest!
elsif warrior.feel.empty?
warrior.walk!(:forward)
else
warrior.attack!(:forward)
@bp.route('lang',methods=['GET'])
def GET_lang():
"""
Returns the language requested by the browser
defaults to en-US
"""
try:
headers = self.request.headers
return headers['Accept-Language'] || "en-US,en;q=0.8"
except Exceptions as e:
@cromulus
cromulus / keybase.md
Last active September 22, 2015 17:48

Keybase proof

I hereby claim:

  • I am cromulus on github.
  • I am bcromie (https://keybase.io/bcromie) on keybase.
  • I have a public key whose fingerprint is 2E8D 69FA 9C61 3487 EB49 BE02 6BFC A720 006A B2DE

To claim this, I am signing this object:

@cromulus
cromulus / Vagrantfile
Created December 17, 2015 15:13
Vagrantfile for super quick rails development
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@cromulus
cromulus / Passwordless nfs for vagrant
Last active June 13, 2016 19:55
Passwordless nfs and hostmanager for vagrant
## add this to your /etc/sudoers file
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp /Users/bill/.vagrant.d/tmp/hosts.local /etc/hosts
%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE, VAGRANT_HOSTMANAGER_UPDATE
# for vagrant-hostmanager
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp <home-directory>/.vagrant.d/tmp/hosts.local /etc/hosts
%<admin-group> ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
@cromulus
cromulus / Howto
Created December 28, 2015 19:31
How To Modify the heatseekos.img image
first off, you need a linux machine and must be uid 1000, usually this is the first user created on the system.
to find out your id, run this command: `id`
Then find a free loop device:
```
sudo losetup -f
```
usually that will return `loop0` but if not, use whatever it returns in the place of `loop0` in the commands below.
next, load the image into the loop device and mount it.
@cromulus
cromulus / vagrant-bootstrapper.ps1
Last active January 5, 2016 15:37 — forked from mefellows/vagrant-bootstrapper.ps1
Windows Vagrant with Rsync powershell bootstrap script
Write-Host -ForegroundColor green "Bootstrapping machine"
Write-Host "Setting up package management and installing required packages for Dev."
#
# Install Choco (if not already installed) + required packages
#
if ( (Get-Command "choco" -errorAction SilentlyContinue) ) {
Write-Host "Chocolatey already installed. Skipping."
} else {
ubuntu@brlrh01:~$ sudo flynn-host fix --min-hosts 3 --peer-ips 192.168.200.11,192.168.200.12,192.168.200.13
INFO[08-15|20:12:44] found expected hosts n=3
INFO[08-15|20:12:44] ensuring discoverd is running on all hosts
INFO[08-15|20:12:44] checking flannel
INFO[08-15|20:12:44] flannel looks good
INFO[08-15|20:12:44] waiting for discoverd to be available
INFO[08-15|20:12:44] checking for running controller API
INFO[08-15|20:12:44] found running controller API instances n=2
INFO[08-15|20:12:44] found controller instance, checking critical formations
INFO[08-15|20:12:44] checking status of sirenia databases
@cromulus
cromulus / gist:2b9226743fd2fb4acd5403b47ab3cf3d
Created December 6, 2016 16:16
sovereign development environment issues
# Note: I disabled xmpp in site.yml because of https://github.com/sovereign/sovereign/issues/624
$vagrant destroy -f && vagrant up
==> xenial: VM not created. Moving on...
==> jessie: Forcing shutdown of VM...
==> jessie: Destroying VM and associated drives...
Bringing machine 'jessie' up with 'virtualbox' provider...
==> jessie: Importing base box 'box-cutter/debian8'...
==> jessie: Matching MAC address for NAT networking...
==> jessie: Checking if box 'box-cutter/debian8' is up to date...
==> jessie: Setting the name of the VM: sovereign_jessie_1481038318155_73409