Skip to content

Instantly share code, notes, and snippets.

View woile's full-sized avatar

Santiago Fraire Willemoes woile

View GitHub Profile
@malderete
malderete / redis_lock_manager.py
Last active October 30, 2015 18:39
Redis Lock using python-redis library
import socket
import redis
class RedisLock(object):
"""Redis Lock implementation over redis.StrictRedis.lock.
:param strict_client: A StrictRedis client.
:type strict_client: redis.StrictRedis.
@dlitvakb
dlitvakb / astar.py
Created October 7, 2015 21:54
AStar structured version
from __future__ import print_function
import random
import math
BLOCKED = u'\u2588'
EMPTY = " "
START = "A"
FINISH = "B"
anonymous
anonymous / conkyrc
Created August 26, 2015 02:19
######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
if_up_strictness link
#background yes
anonymous
anonymous / setup.cfg
Created November 23, 2014 17:32
drive-in extension for distutils of python 2.7: use [metadata]-section of setup.cfg to "auto-fill" the keyword-arguments of core.setup function.
[metadata]
name = foo
version = 0.1
author = Don Question
author-email = donquestion@example.com
description = Demonstrates a declarative setup setup.
description-file = README.md
classifiers = Development Status :: 4 - Beta
License :: OSI Approved :: MIT License
Operating System :: POSIX :: Linux
# coding=UTF-8
from __future__ import division
import nltk
from collections import Counter
# This is a simple tool for adding automatic hashtags into an article title
# Created by Shlomi Babluki
# Sep, 2013
@cobyism
cobyism / gh-pages-deploy.md
Last active June 5, 2024 21:48
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@jboner
jboner / latency.txt
Last active June 9, 2024 15:21
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ssokolow
ssokolow / pagination_example.sql
Created December 23, 2009 13:02
Reasonably efficient pagination without OFFSET (SQLite version)
-- Reasonably efficient pagination without OFFSET
-- SQLite version (Adapted from MS SQL syntax)
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6
SELECT foo, bar, baz, quux FROM table
WHERE oid NOT IN ( SELECT oid FROM table
ORDER BY title ASC LIMIT 50 )
ORDER BY title ASC LIMIT 10