Skip to content

Instantly share code, notes, and snippets.

@pdxjohnny
pdxjohnny / sub.sh
Created April 30, 2015 17:44
Add srt subtitles to mp4
#!/bin/bash
ffmpeg -i ${1}.srt ${1}.ass
ffmpeg -i ${1}.mp4 -vf ass=${1}.ass ${1}_subtitles.mp4
@pdxjohnny
pdxjohnny / sh.s
Last active August 29, 2015 14:20
Spawn sh shell
.file "sh.s"
.text
.globl main
.type main, @function
main:
subl $32, %esp
movb $0x2f, 16(%esp)
movb $0x62, 17(%esp)
movb $0x69, 18(%esp)
@pdxjohnny
pdxjohnny / upload.py
Last active August 29, 2015 14:20
Script to change version and upload to PyPi
#!/usr/bin/python
import os
import sys
import shutil
PACKAGE_NAME = "some_package"
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
@pdxjohnny
pdxjohnny / metadata.txt
Last active August 29, 2015 14:20
Downloads youtube videos as music, metadata.txt is column numbers
[metadata]
title = 1
artist = 2
album = 3
@pdxjohnny
pdxjohnny / config.py
Created May 11, 2015 15:49
Grabs config sections as dicts
"""
config.py
John Andersen
johnandersenpdx@gmail.com
This file provides quick access to sections
of a config file by use of ConfigParser.
"""
import os
@pdxjohnny
pdxjohnny / sc_api.js
Last active August 29, 2015 14:21
Apis for smart cities
var sc_api = function sc_api (sub_domain, js_type)
{
this.protocol = "http";
this.domain = "datadash.io";
// Defualt sub_domain is pdx
if ( typeof sub_domain === "undefined" )
{
sub_domain = "pdx";
}
this.sub_domain = sub_domain;
@pdxjohnny
pdxjohnny / math.js
Created May 20, 2015 06:56
Javascript math functions
<script type="text/javascript">
function factor ( mult, add )
{
if ( mult > 0 )
{
for ( var i = -mult; i < mult; ++i )
{
for ( var j = mult; j >= -mult; --j )
{
if ( i * j == mult && i + j == add )
@pdxjohnny
pdxjohnny / setup.sh
Last active November 23, 2015 21:06
The best server setup script ever
#!/bin/bash
# Make sure we are passed a username so we can add the user to a docker group
USER=""
if [ "$1" != "" ]; then
USER=$1
else
echo You need to enter a username or '${USER}' as the fisrt argument
exit 0
fi
@pdxjohnny
pdxjohnny / docker-compose.yml
Last active August 29, 2015 14:22
Docker gitlab scripts
postgresql:
image: sameersbn/postgresql:9.4
environment:
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
volumes:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql
gitlab:
image: sameersbn/gitlab:7.11.3
@pdxjohnny
pdxjohnny / docker-compose.yml
Last active August 29, 2015 14:22
Docker couchdb scripts
couchdb:
image: klaemo/couchdb:latest
ports:
- "15984:5984"
volumes:
- /srv/docker/couchdb:/usr/local/var/lib/couchdb