This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Eron's .vimrc settings. | |
" check this out: http://www.vim.org/scripts/script.php?script_id=2332 | |
call pathogen#infect() | |
set ruler | |
set nowrap | |
set autoindent | |
set tw=120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rsync -ruP --delete %1 %2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# sshme - opens a shell to a known location, defined in the user's ~/.sshme file | |
# | |
# by Eron Hennessey | |
# | |
# The .sshme file is simply a file that contains a list of aliases to ssh | |
# locations, like this: | |
# | |
# serveralias1 path.to.server1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check for an update on a web-page, and email the user | |
import httplib | |
import sys | |
import pickle | |
from datetime import datetime | |
import smtplib | |
from email.mime.text import MIMEText | |
import yaml | |
def email_user(cur_data, email_from, email_to): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean JSON. Takes messy JSON and makes it much nicer looking. | |
# | |
# Usage: | |
# | |
# ruby cleanjson.rb <infile> <outfile> | |
# | |
# Reads the JSON-formatted text in <infile> and outputs the cleaned JSON to | |
# <outfile>. | |
# | |
# Both arguments are optional, but you cannot specify an <outfile> without |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'yaml' | |
json_file, yaml_file = ARGV | |
json_text = nil | |
unless json_file.nil? | |
if File.exist?(json_file) | |
json_text = File.new(json_file, 'r').read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'xmlsimple' | |
json_file, xml_file = ARGV | |
json_text = nil | |
unless json_file.nil? | |
if File.exist?(json_file) | |
json_text = File.new(json_file, 'r').read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List the S3 buckets that are available for the user identified by either | |
# `aws-config.txt` or in the environment. | |
require 'aws-sdk' | |
require 'yaml' | |
CONFIG_FILE_NAME = 'aws-config.txt' | |
# Load aws-config.txt to see if there are AWS credentials there. | |
# | |
# We're expecting a YAML-formatted file like this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk' | |
require 'yaml' | |
CONFIG_FILE_NAME = 'aws-config.txt' | |
def do_confirm(phrase) | |
print "#{phrase} (Y/N): " | |
# you *must* use $stdin with gets if you have command-line arguments. | |
# Otherwise, gets receives streaming input and doesn't wait for the terminal. | |
a = $stdin.gets.strip.downcase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import re | |
def camel2snake(text, sep=r'_'): | |
"""Convert *text* from CamelCase (or camelCase) into snake_case.""" | |
rebounds = [r'([a-z])([A-Z])', r'([A-Z])([A-Z])'] | |
underscored_text = str(text) | |
for b in rebounds: | |
underscored_text = re.sub(b, (r'\g<1>'+ sep + r'\g<2>'), underscored_text) |
OlderNewer