Skip to content

Instantly share code, notes, and snippets.


Tim Sabat tsabat

View GitHub Profile
tsabat /
Created Feb 7, 2021 — forked from defulmere/
How to override an old sqlite3 module with pysqlite3 in django
# first: pip install pysqlite3-binary
# then in
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
'default': {
tsabat /
Last active Sep 12, 2017 — forked from BretFisher/
Install Docker PPA on Ubuntu 16.04
# NOT FOR SHELL SCRIPT, but rather just for quick copy paste
# this is a copy-paste version with defaults of full shell script
apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
mkdir -p /etc/apt/sources.list.d && \
echo deb 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.

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:
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 MeetupAPI.rb
# this request will show you a headcount of 10\?sign\=true\&key\=59512b1f5939553e4e7962a15154c
# this request will show you the attendance *NOTICE* the members id's are
# missing
# Same attendance request with filter=all
@author Bommarito Consulting, LLC
@date 20120622
Identify and, if requested, remove orphaned snapshots from an EC2 account.
# Imports
import boto
# Install 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 cleanup_snapshots
#!/usr/bin/env ruby
# Cleanup EC2 EBS snapshots.
# Originally from:
require 'rubygems'
require 'right_aws'

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'