Skip to content

Instantly share code, notes, and snippets.

View gettweetgif_algorithm.txt
How To Get A GIF From A Tweet
Twitter converts uploaded .gif files to a video for ease of use. However,
you may want to get this .gif file. As far as I know it's
not possible to download the raw .gif file, if any, that Twitter stores.
However, it is possible to download the video file using curl and
convert it to a gif using ffmpeg (though making a high quality .gif
may require some knowledge of ffmpeg's arcane parameters).
#!/usr/bin/env python3
import sys, os
def alert():
os.system('say -v Tessa "Your task has been completed."')
def alert_on_pipe_close():
while True:
View groupcities.js
// groupcities.js
// An alternative solution to:
// Given an array of city names, group the ones that are rotations of
// each other together. e.g.:
// input: ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
// output:
// [
# python 3.6+
# written for:
import sys, random, argparse
parser = argparse.ArgumentParser(
description='Print the numbers from 0000 to 9999 in random order.')
View neurochromohexonics.html
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<!-- Synaptic neural net library -->
<script src=""></script>
<!-- fight me -->
from itertools import islice
def ints_from(start=2, step=1):
next = start
while True:
next += step
yield next
def take(n, iterable):
"""Return first n items of the iterable as a list
View _div.html.erb
View bitsnake.rb
# bitsnake.rb
# A solution to the Ancient City Ruby 2016 programming challenge:
# Dustin King ( / @cathodion )
# Counts the number of paths through an 10x10 grid of city blocks
# moving only East and South.
# A hack to enable calling functions as if they were methods
# Author: Dustin King (
# Grown from this tweet by Zygmunt Zając:
# Superseded by:
class Funverted:
'''Streaming pickle implementation for efficiently serializing and
de-serializing an iterable (e.g., list)
Created on 2010-06-19 by Philip Guo
Mostly rewritten 2015-01-16 by Dustin King for Python 3.4
Not backwards compatible.
2.7 version here:
You can’t perform that action at this time.