Skip to content

Instantly share code, notes, and snippets.

View tsabat's full-sized avatar

Tim Sabat tsabat

View GitHub Profile
@tsabat
tsabat / lets_breakup.py
Last active July 1, 2022 16:18
Breaks a large csv file up into smaller chunks.
#!/usr/bin/env python
import sys
import csv
import argparse
from pathlib import Path
import chardet
from urllib3 import encode_multipart_formdata
csv.field_size_limit(sys.maxsize)
## The Problem
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)
## The temptingly easy but ultimately wrong solution:
Alter the port the script talks to from 8000 to 80:
}).listen(80);
'''
@author Bommarito Consulting, LLC
@date 20120622
Identify and, if requested, remove orphaned snapshots from an EC2 account.
'''
# Imports
import boto
@tsabat
tsabat / unused.py
Created February 22, 2014 20:42
delete unused ebs volumes
#! env python
from boto import ec2
conn = ec2.connect_to_region('us-west-2')
vols = conn.get_all_volumes(filters={'status': 'available'})
for vol in vols:
print 'checking vol:', vol.id, 'status:', vol.status, 'attachment_id:', vol.attach_data.status
conn.delete_volume(vol.id)
@tsabat
tsabat / for_dee.md
Last active August 29, 2015 13:55
rails stack from start to finish
  • create a root user >
  • Install ruby via rbenv >
  • Install phusion passenger >
  • Set up capistrano in your project's Gemfile >
  • change your nginx/default server
  • set up capistrano
  • install node >

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham winhamwr@gmail.com

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

@tsabat
tsabat / remove.md
Last active December 20, 2015 17:18

remove all but last 5. Run this from the releases directory.

sudo rm -rf `ls -t | awk 'NR>5'`
@toretore
toretore / _etc_dbus-1_system.d_Upstart.conf
Last active December 15, 2015 00:28
Upstart config for running thin (or anything else, I guess) through rbenv Chances are your OS hasn't enables so-called user jobs by default and you'll have to edit the upstart config for this to work. I've included the upstart config file I've used. Upstart also won't run any user jobs by default because they won't hav been loaded into its syste…
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only the root user can own the Upstart name -->
<policy user="root">
<allow own="com.ubuntu.Upstart" />
</policy>
#!/usr/bin/env ruby
#
#
# Cleanup EC2 EBS snapshots.
#
# Originally from: http://www.elastdream.com/2009/04/snapshots.html
#
require 'rubygems'
require 'right_aws'

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install: