Skip to content

Instantly share code, notes, and snippets.

View tsabat's full-sized avatar

Tim Sabat tsabat

View GitHub Profile

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.

@tsabat
tsabat / settings.py
Created February 7, 2021 22:32 — forked from defulmere/settings.py
How to override an old sqlite3 module with pysqlite3 in django settings.py
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
'default': {
@tsabat
tsabat / docker-xenial-copy-paste.sh
Last active September 12, 2017 05:31 — forked from BretFisher/docker-xenial-copy-paste.sh
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 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 && \
#!/usr/bin/env ruby
#
#
# Cleanup EC2 EBS snapshots.
#
# Originally from: http://www.elastdream.com/2009/04/snapshots.html
#
require 'rubygems'
require 'right_aws'
'''
@author Bommarito Consulting, LLC
@date 20120622
Identify and, if requested, remove orphaned snapshots from an EC2 account.
'''
# Imports
import boto
@tsabat
tsabat / explain.md
Created December 19, 2012 22:40 — forked from anonymous/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'
@tsabat
tsabat / doula-install.sh
Created March 12, 2012 17:15 — forked from whitmo/doula-install.sh
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
## 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 / jetty
Last active August 29, 2015 14:13 — forked from peterc/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
# ========================
# 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