Skip to content

Instantly share code, notes, and snippets.

View dufferzafar's full-sized avatar

Shadab Zafar dufferzafar

View GitHub Profile
@dufferzafar
dufferzafar / Kick-Ass youtube-dl gui.md
Created December 5, 2014 22:00
A kick-ass GUI for youtube-dl #python #qt #ideabin

youtube-dl if you've not heard of it, is a great downloader for youtube (and a lot of other sites.)

The application has an awesome CLI, but a GUI could have things like:

  • Pause/Resume
  • Skip already downloaded files (-w)
  • Add all links from a playlist individually, so you can control their downloads individually.
  • Move downloads to folders based on categories/channels (I think this can already be done via output paths.)

Our GUI based app could be multi-threaded. (Async downloads?)

@dufferzafar
dufferzafar / Inorder.c
Last active August 29, 2015 14:11
In-order traversal of a Binary Search Tree without using stack or recursion.
#include <stdlib.h>
#include <stdio.h>
/**
* Node structure of the BST
*/
struct Node
{
int data;
struct Node* left;
@dufferzafar
dufferzafar / Build-HAC.sh
Created December 18, 2014 15:37
Built HAC from multiple chapters
# Remove the Initial page from all files.
for file in *.pdf
do
F:/Powerpack/Cmder/vendor/pdftk/pdftk.exe $file cat 2-end output "${file%.*}-new.pdf"
done
F:/Powerpack/Cmder/vendor/pdftk/pdftk.exe *-new*.pdf cat output "Handbook.pdf"
F:/Powerpack/Cmder/vendor/pdftk/pdftk.exe "toc3.pdf" "Handbook.pdf" cat output "Handbook of Applied Cryptography.pdf"
@dufferzafar
dufferzafar / capslock_to_backspace.sh
Created January 9, 2015 10:24
Remap Capslock to Backspace
# Tested on Ubuntu 12.04
# Copied from: http://askubuntu.com/questions/74904/how-can-i-swap-capslock-for-backspace
setxkbmap -option caps:backspace
setxkbmap -option shift:both_capslock
xmodmap -e "clear Lock"
@dufferzafar
dufferzafar / del_file.sh
Created January 9, 2015 11:22
Delete a file with special characters in its name.
# First find out the inode by
# ls -il .
# Then delete file
sudo find . -inum $1 -exec rm -rf {} \;
@dufferzafar
dufferzafar / wvdial.conf
Created January 14, 2015 06:53
MTS Details for wvdial. (/etc/wvdial.conf)
[Dialer Defaults]
Phone =
Username =
Password =
New PPPD = yes
[Dialer mts]
Stupid Mode = 1
Inherits = Modem0
Password = mts
@dufferzafar
dufferzafar / Download-File-Github.md
Created January 20, 2015 15:37
Download a single file from Github #github #userscript #ideabin

Add a button to initiate download of a single file from a file page on Github.

@dufferzafar
dufferzafar / tfidf.py
Last active August 29, 2015 14:14 — forked from sloria/tfidf.py
import math
from text.blob import TextBlob as tb
def tf(word, blob):
return blob.words.count(word) / len(blob.words)
def n_containing(word, bloblist):
return sum(1 for blob in bloblist if word in blob)
def idf(word, bloblist):
@dufferzafar
dufferzafar / lastfm-make.log
Last active August 29, 2015 14:14
Output of 'make -i -j4' - trying to build lastfm-desktop on Ubuntu 14.04
cd lib/logger/ && make -f Makefile
make[1]: Entering directory `/home/dufferzafar/dev/clones/lastfm-desktop/lib/logger'
compiling ../../common/c++/Logger.cpp
rm -f liblogger.a
ar cqs liblogger.a _build/Logger.o
rm -f ../../_bin/liblogger.a
mv -f liblogger.a ../../_bin/
make[1]: Leaving directory `/home/dufferzafar/dev/clones/lastfm-desktop/lib/logger'
cd lib/unicorn/ && make -f Makefile
make[1]: Entering directory `/home/dufferzafar/dev/clones/lastfm-desktop/lib/unicorn'
@dufferzafar
dufferzafar / reset-postgres.sh
Created February 14, 2015 08:25
Reset Postgres (Ubuntu 14.04)
#!/bin/sh
sudo service postgresql stop
sudo pg_dropcluster 9.1 main
sudo pg_createcluster 9.1 main
sudo pg_ctlcluster 9.1 main start
sudo service postgresql start