Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Sabat tsabat

View GitHub Profile
View ubuntu_ruby_install.sh
#!/bin/bash
# Install rbenv
# https://github.com/sstephenson/rbenv
cd ~
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev \
libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev -y
View MeetupAPI.rb
# this request will show you a headcount of 10
https://api.meetup.com/2/event/5898549\?sign\=true\&key\=59512b1f5939553e4e7962a15154c
# this request will show you the attendance *NOTICE* the members id's are
# missing
https://api.meetup.com/momsmeetupofco/events/5898549/attendance%5C?sign%5C=true%5C&key%5C=59512b1f5939553e4e7962a15154c
# Same attendance request with filter=all
http https://api.meetup.com/momsmeetupofco/events/5898549/attendance\?sign\=true\&key\=59512b1f5939553e4e7962a15154c\&filter\=all
@tsabat
tsabat / jetty
Last active Aug 29, 2015 — forked from peterc/jetty
View jetty
#!/usr/bin/env bash
#
# Startup script for jetty under *nix systems (it works under NT/cygwin too).
# To get the service to restart correctly on reboot, uncomment below (3 lines):
# ========================
# chkconfig: 3 99 99
# description: Jetty 7 webserver
# processname: jetty
# ========================
View node-on-ec2-port-80.txt
## 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);
@tsabat
tsabat / doula-install.sh
Created Mar 12, 2012 — forked from whitmo/doula-install.sh
doula-install.sh
View doula-install.sh
rm -rf $VIRTUAL_ENV/build
ZMQVERSION=zeromq-2.1.11
if [ ! -d $ZMQVERSION ]
then
wget -O - "http://download.zeromq.org/${ZMQVERSION}.tar.gz" | tar -xvzf -
fi
pushd . > /dev/null
cd $ZMQVERSION
./configure --prefix $VIRTUAL_ENV
View explain.md

so, for the below script, we store the values in a text file that we read into mysql.

we then have 1000 unique URLs per row in a table, separated by a colon. We read and split one row at a time into a redis set, then pop values off the set whenever we need a new url. When the set is empty, we read the next row from mysql into the set.

The only thing to look out for is your collation in the db. A lookup is utf8_ci (case-insnsitive) for queries unless you set your collation to utf8_bin

collation-server = utf8_bin
init-connect='SET NAMES utf8'
init_connect='SET collation_connection = utf8_bin'
View clean_orphaned_snapshots.py
'''
@author Bommarito Consulting, LLC
@date 20120622
Identify and, if requested, remove orphaned snapshots from an EC2 account.
'''
# Imports
import boto
View cleanup_snapshots
#!/usr/bin/env ruby
#
#
# Cleanup EC2 EBS snapshots.
#
# Originally from: http://www.elastdream.com/2009/04/snapshots.html
#
require 'rubygems'
require 'right_aws'
@tsabat
tsabat / docker-xenial-copy-paste.sh
Last active Sep 12, 2017 — forked from BretFisher/docker-xenial-copy-paste.sh
Install Docker PPA on Ubuntu 16.04
View docker-xenial-copy-paste.sh
# NOT FOR SHELL SCRIPT, but rather just for quick copy paste
# this is a copy-paste version with defaults of full shell script docker-xenial.sh
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
mkdir -p /etc/apt/sources.list.d && \
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && apt-get upgrade -y -q && \
apt-get install -y -q linux-image-extra-$(uname -r) linux-image-extra-virtual && \
apt-get install -y -q docker-engine && \
View HTML5-Audio-Player-w--Responsive-Playlist.markdown

HTML5 Audio Player w/ Responsive Playlist

I changed this!

This is an HTML5 audio player that detects the user agent of your device/browser/OS and applies styling that matches the native audio player. The playlist responds to the width of your screen and features basic UI controls.

Feel free to fork this pen and add your own user agent styles for different browsers, devices and operating systems.