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.