Skip to content

Instantly share code, notes, and snippets.

@joequery
joequery / gist:9778704
Last active August 29, 2015 13:57
FFmpeg - video of image fading out
# ffmpeg -loop 1 -i logo.png -filter_complex "[0:v]fade=out:st=2.5:d=1.5[ov]" -map "[ov]" -c:a copy -c:v libx264 -t 5 out.mp4; ffmpeg -f lavfi -i aevalsrc=0 -i out.mp4 -vcodec copy -acodec aac -map 0:0 -map 1:0 -shortest -strict experimental -y out.mp4
... add two and cook it into small stewpan, add sugar. Add at the backbone, and
soak in the water. ROAST KID WITH CHEESE CROQUETTES.Cook it hot; stir this is
cooked by the vegetable.
...If you would a moment stir it becomes brown, fry them in the meat.
STUFFED WITH MUSHROOMS, OR THE CHILDREN If you wish
@joequery
joequery / gist:8571726
Last active January 4, 2016 04:58
Upgrading ruby
$ sudo apt-get update
$ sudo apt-get install ruby-odbc-dbg
$ sudo apt-get install ruby1.9
$ sudo ln -sf /usr/bin/ruby1.9.3 /usr/bin/ruby
# Log out of the vm via exit, then log back in via vagrant ssh
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
@joequery
joequery / gist:8564118
Last active January 4, 2016 03:49
Django - Delete data for all models of a single app
from django.contrib.contenttypes.models import ContentType
cts = ContentType.objects.filter(app_label="article")
for ct in cts:
TheModel = ct.model_class()
records = TheModel.objects.all()[:100]
while records:
pks = [r.pk for r in records]
TheModel.objects.filter(pk__in=pks).delete()
records = TheModel.objects.all()[:100]
@joequery
joequery / gist:7990173
Created December 16, 2013 16:48
testing django apps using django_discover_runner. Allows you to specify paths so you can use linux file autocompletion.
#!/usr/bin/env python
import sys
import subprocess
if len(sys.argv) != 2:
exit("Improper usage. Do pytest test/path/to/tests.someTestCase.some_test")
command_list = ["python", "manage.py", "test"]
test_path = sys.argv[1].replace("/", ".")
command_list.append(test_path)
@joequery
joequery / gist:7948727
Created December 13, 2013 18:19
Best spam email ever
If this email ends up in your spam folder move it to your inbox so links and
attachments would be active, you won't regret it!!!
Instead of $660* just $19.99(
look here!
[link removed]
), special Christmas offer, check the attachments!
@joequery
joequery / enumeration_example.py
Created November 13, 2013 17:59
Python enumerate()
>>> # Suppose we have this list of tuples, each of length two.
... # Element 1 is a persons first name, element 2 is their last name
...
>>> names = [('Joseph', 'McCullough'), ('Luke', 'PolishLastName')]
>>> # Now, if we do a normal for loop, the item per each iteration is
... # a tuple
...
>>> for name in names:
... print("first: " + name[0])
... print("last: " + name[1])
@joequery
joequery / gist:6528193
Created September 11, 2013 18:59
Altered Un-minified mapbox
(function () {
var t;
(function (t, e, i) {
function n(i, s) {
if (!e[i]) {
if (!t[i]) {
var r = "function" == typeof require && require;
if (!s && r) return r(i, !0);
if (o) return o(i, !0);
throw Error("Cannot find module '" + i + "'")
(function () {
var t;
(function (t, e, i) {
function n(i, s) {
if (!e[i]) {
if (!t[i]) {
var r = "function" == typeof require && require;
if (!s && r) return r(i, !0);
if (o) return o(i, !0);
throw Error("Cannot find module '" + i + "'")
@joequery
joequery / gist:6271117
Last active December 21, 2015 07:28
Jarnal executables
# File: jaj2pdf
# Quickly convert jarnal files to pdf. Page dimensions don't seem to be
# preserved unfortunately
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
java -Xms64m -Xmx512m -jar $DIR/jarnalDir/jarnal.jar -pdf - $1
# File: jarnal
# Open up jarnal!
#!/bin/bash