Skip to content

Instantly share code, notes, and snippets.

View dufferzafar's full-sized avatar

Shadab Zafar dufferzafar

View GitHub Profile
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active October 7, 2025 16:12
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chew-z
chew-z / ctrl-vim
Created April 7, 2017 11:07
Ctrl-Vim fuzzy find last edited files
#!/usr/bin/env zsh
#
# Fuzzy find recently edited with [m(vim)|edit|subl] files
# gource in .zshrc and press (Ctrl-V) to call from shell.
# (Enter) opens in vim or (Ctrl-M) in MacVim. Previev (?)
fzf-edit-file-in-vim-or-mvim() {
local out key file helpline
local Vim_binary='/Applications/MacVim.app/Contents/MacOS/Vim'
helpline="<Ctrl-M> opens in MacVim | <?> toggles preview"
@ntasos
ntasos / kdialog-open-files.lua
Last active June 7, 2025 06:14
KDialog-open-files, a lua script for mpv media player that uses KDE KDialog to open files, subtitles or URLs.
-- This is free and unencumbered software released into the public domain.
-- The software is provided "as is", without warranty of any kind.
-- Anyone is free to copy, modify, publish, use, compile, sell, or
-- distribute this software, either in source code form or as a compiled
-- binary, for any purpose, commercial or non-commercial, and by any means.
-- For more information, please refer to <http://unlicense.org/>
--
-- Use KDE KDialog to add files to playlist, subtitles to playing video or open URLs.
-- Based on 'mpv-open-file-dialog' <https://github.com/rossy/mpv-open-file-dialog>.
--
@ssokolow
ssokolow / x11_watch_active_window.py
Last active October 30, 2025 02:18
python-xlib example which reacts to changing the active window
#!/usr/bin/env python
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
Tested with Python 2.x because my Kubuntu 14.04 doesn't come with python-xlib
for Python 3.x.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@samrocketman
samrocketman / libimobiledevice_ifuse_Ubuntu.md
Last active September 27, 2025 02:50
On Ubuntu 16.04, since iOS 10 update, libimobiledevice can't connect to my iPhone. This is my attempt to document a fix.

Why this document?

I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).

The solution is to compile libimobiledevice and ifuse from source.

Audience

Who is this guide intended for?

@juanpabloaj
juanpabloaj / README.md
Last active June 18, 2018 13:02
Total of pip packages downloaded, separated by Python versions

Total of pip packages downloaded separated by Python versions

From June 26, 2016 (python 3.5.2 release) to Aug. 31, 2016.

Python versions from 2.6 to 3.5

downloads_by_versions

Without 2.7

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@benhoyt
benhoyt / snakes_and_ladders.py
Last active May 20, 2018 09:02
Calculate the average number of moves in a snakes and ladders game
"""Calculate the average number of moves in a snakes and ladders game.
Because as a parent one gets roped into these board (boring?) games
every so often, and I wanted to calculate the average duration of a
snakes and ladders game. Turns out it's about 36 moves (though
admittedly that's for a single-player game). :-)
> python snakes_and_ladders.py
Played 10000 rounds, averaged 36.0559 moves, max 324 moves, took 0.508s
"""
@freach
freach / bench_datetime_libs.py
Created August 4, 2016 19:59
Compare instantiation, parsing and formatting of several different Python date-time libraries
from __future__ import print_function
import sys
from datetime import datetime
from time import time
try:
import arrow
except ImportError:
print('pip install arrow')