Skip to content

Instantly share code, notes, and snippets.

View pelegm's full-sized avatar

Peleg Michaeli pelegm

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drdrang
drdrang / clockface
Last active August 4, 2016 21:13
Prints Emoji clockface of the given time rounded to the nearest half-hour. Uses current time if none given. After https://github.com/RobTrew/txtquery-tools/blob/master/utilities/emotime.sh
#!/usr/bin/python
# -*- coding: utf-8 -*-
from sys import argv
from time import strftime
clocks = {'12:00': '🕛', '12:30': '🕧', '1:00': '🕐', '1:30': '🕜',
'2:00': '🕑', '2:30': '🕝', '3:00': '🕒', '3:30': '🕞',
'4:00': '🕓', '4:30': '🕟', '5:00': '🕔', '5:30': '🕠',
'6:00': '🕕', '6:30': '🕡', '7:00': '🕖', '7:30': '🕢',
@scmx
scmx / upgrade-install-ruby-2-1-2-ubuntu-12-04.md
Last active November 6, 2019 15:31
Upgrade/Install ruby 2.1.2 #ubuntu #12.04 #14.04

Upgrade/Install ruby 2.1.2

ubuntu 12.04 14.04

Reference http://stackoverflow.com/a/18490935/2037928

Login as root

Install needed packages

apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
@darius
darius / gist:173482
Created August 23, 2009 22:14
Better random.sample()?
"""
Would this make a better random.sample() function for the Python
standard library? Robert Floyd's algorithm as presented in Jon
Bentley, "A Sample of Brilliance".
Answer: no, it's slower; somewhat slower even if you tune it.
I tried a few different test cases -- both small and large
result lists. I'd expect it to use much less memory in some cases,
but my flailings turned up no case where that seemed to matter.