Skip to content

Instantly share code, notes, and snippets.

@coderanger
coderanger / eveskill.py
Created September 17, 2013 02:54
Script to format an Eve skill plan for BBCode.
from __future__ import division
import copy
from gettext import ngettext
from bs4 import BeautifulSoup
attributes = {
'intelligence': 20,
'perception': 20,
'charisma': 19,
@coderanger
coderanger / README.md
Last active December 31, 2015 04:39
Notes from WiE: Change The Ratio

I was part of a group discussing recruiting and on-boarding of women (and to a lesser degree minorities in general). Some highlights that we settled on :

  1. Include at least one woman on interview panels for women candidates. This helps to make it clear that the company isn't a mono-culture and reduces the "I don't look like anyone here" effect of being a lone woman in a room full of middle-aged white guys (and maybe a woman recruiter, which only exacerbates things). This may not be possible if you currently have no woman engineers, but try.
  2. Be willing to hire junior engineers, both when looking for women and just in general. While it is a bigger risk and requires more upfront investment, you greatly increase your available talent pool.
  3. Have a "buddy system" during on-boarding, and actually train your mentors rather than just throwing them into it. When possible, pair new employees with someone of a similar gender/minority/background to help people know they are not alone in your organization. Some ti
@coderanger
coderanger / data.txt
Created December 24, 2013 06:57
Rackspace server info
$ knife rackspace flavor list
ID Name VCPUs RAM Disk
2 512MB Standard Instance 1 512 20 GB
3 1GB Standard Instance 1 1024 40 GB
4 2GB Standard Instance 2 2048 80 GB
5 4GB Standard Instance 2 4096 160 GB
6 8GB Standard Instance 4 8192 320 GB
7 15GB Standard Instance 6 15360 620 GB
8 30GB Standard Instance 8 30720 1200 GB
performance1-1 1 GB Performance 1 1024 20 GB
@coderanger
coderanger / rpm.rb
Last active January 3, 2016 00:08
Modified rpm formula to install the Python bindings too.
require 'formula'
class RpmDownloadStrategy < CurlDownloadStrategy
def initialize name, resource
super
@tarball_name = "#{name}-#{resource.version}.tar.gz"
end
def stage
safe_system "rpm2cpio.pl <#{tarball_path} | cpio -vi #{@tarball_name}"
@coderanger
coderanger / fuckitencoder.py
Created January 17, 2014 21:21
For when you absolutely, positively must get something that looks like JSON.
MEMORY = '<memory>'
class FuckItEncoder(json.JSONEncoder):
def default(self, obj):
try:
return json.JSONEncoder.default(self, obj)
except RuntimeError:
return '<recur>'
except MemoryError:
return MEMORY
except TypeError:
@coderanger
coderanger / balanced.json
Created February 11, 2014 18:43
Balanced packer config
{
"variables": {
"aws_access_key_id": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_access_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_account_id": "4819-1673-9571",
"s3_bucket": "balanced-amis",
"x509_cert_path": "{{pwd}}/balanced-aws.crt",
"x509_key_path": "{{pwd}}/balanced-aws.key"
},
"builders": [
@coderanger
coderanger / reconnect.pl
Created February 16, 2014 02:03
Reconnect plugin for Tigerlily
use strict;
my $reconnect_timer;
sub try_reconnect {
my $ui = ui_name("main");
my $server = active_server();
if(!$server) {
$ui->print("(trying to reconnect)\n");
TLily::Event::send(
@coderanger
coderanger / README.md
Last active August 29, 2015 13:56
Command to run depsolver

To use this snippet first replace the _default in the URL with your environment name if you are using somethign other than the global default. Next in the run list, replace ... with your cookbook names. Unlike other run lists, you cannot have roles here, and you don't use the 'recipe[foo]' syntax, just 'foo'.

@coderanger
coderanger / recon.py
Created April 8, 2014 01:17
Quick script to scrape OpenSSL versions
#!/usr/bin/env python
import os
import subprocess
import json
from boto.ec2 import connect_to_region
REGIONS = ['us-east-1', 'us-west-1', 'us-west-2']
@coderanger
coderanger / README.md
Last active August 18, 2023 18:33
How to patch Ubuntu for Heartbleed

How to patch Ubuntu for Heartbleed

  1. sudo apt-get update
  2. sudo apt-get install -y libssl1.0.0 openssl
  3. openssl version -a and confirm the "built on" date is >= 2014-04-07
  4. sudo lsof -n | grep ssl | grep DEL and restart all listed services.

Repeat #4 until no results are returned.