View denoise.sh
# 1. extract audio from all videos (assuming .mp4 videos). | |
for FILE in *.mp4; do ffmpeg -i $FILE ${FILE%%.mp4}.wav; done | |
# 2. use the first second of the first audio file as the noise sample. | |
sox `ls *.wav | head -1` -n trim 0 1 noiseprof noise.prof | |
# Replace with a specific noise sample file if the first second doesn't work for you: | |
# sox noise.wav -n noiseprof noise.prof | |
# 3. clean the audio with noise reduction and normalise filters. |
View partial.py
from functools import partial, partialmethod | |
from timeit import timeit | |
class Partial(Base): | |
def __init__(self): | |
self.p = partial(self.foo, 1) | |
class PartialMethod(Base): |
View dump.sql
PRAGMA foreign_keys=OFF; | |
BEGIN TRANSACTION; | |
CREATE TABLE node ( | |
id INTEGER NOT NULL, -- from Mixin | |
name VARCHAR(200), -- from Mixin | |
published BOOLEAN NOT NULL, | |
type VARCHAR(20), | |
title VARCHAR(200), -- from Mixin | |
PRIMARY KEY (id), | |
CHECK (published IN (0, 1)) |
View twitter.ublock
! Add these under uBlock Settings -> My filters | |
twitter.com##.js-new-items-bar-container | |
twitter.com##.js-activity-favorite | |
twitter.com##.js-activity-favorited_retweet | |
twitter.com##.js-activity-retweet | |
twitter.com##.stream-item-favorited_mention | |
twitter.com##.stream-item-retweet | |
twitter.com##.stream-item-retweeted_retweet | |
twitter.com##.stream-item-retweeted_mention | |
twitter.com##li.people.notifications .count.new-count |
View bulletinbabu.py
#!/usr/bin/env python | |
""" | |
Script to count the emails received by #SpeakForMe | |
""" | |
import os | |
import sys | |
import tweepy | |
import requests |
View upgrade.sh
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <venv_dir>" | |
else | |
rm $1/bin/pip | |
rm $1/bin/pip2 | |
rm $1/bin/pip2.7 | |
rm $1/bin/python | |
rm $1/bin/python2 |
View sum-decimal.py
from random import randint | |
from decimal import Decimal | |
import timeit | |
print "Creating 30 random numbers" | |
ints = [randint(0, 10000) for x in range(30)] | |
print "Converting to decimals" | |
numbers = [Decimal(x) for x in ints] | |
# This method says sum(Decimal) takes ~1600 times more than sum(int) |
View recruiter-spam.txt
@hasgeek , Got this as one of the responses for a listing that | |
specifically asked "NOT OK for recruiters, HR consultants, and other | |
intermediaries to contact this employer" . And I don't understand half | |
of it , what its trying | |
Thanks | |
[snip] | |
---------- Forwarded message ---------- |
View recruiter-spam.txt
@hasgeek , Got this as one of the responses for a listing that | |
specifically asked "NOT OK for recruiters, HR consultants, and other | |
intermediaries to contact this employer" . And I don't understand half | |
of it , what its trying | |
Thanks | |
[snip] | |
---------- Forwarded message ---------- |
View test_docflow.py
# -*- coding: utf-8 -*- | |
import unittest | |
from docflow import (DocumentWorkflow, WorkflowState, WorkflowStateGroup, | |
WorkflowStateException, WorkflowTransitionException, WorkflowPermissionException) | |
class MyDocument(object): | |
def __init__(self): | |
self.status = None | |
self.email = '' |
NewerOlder