This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def insert_bit(array, index): | |
| inner = (index % 64) | |
| index //= 64 | |
| array[index] |= (1 << inner) | |
| def is_set(array, index): | |
| inner = (index % 64) | |
| index //= 64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # as we’re going to use Unicorn as the application server | |
| # we’re not going to use common sockets | |
| # but Unix sockets for faster communication | |
| upstream shop { | |
| # fail_timeout=0 means we always retry an upstream even if it failed | |
| # to return a good HTTP response (in case the Unicorn master nukes a | |
| # single worker for timing out). | |
| # for UNIX domain socket setups: | |
| server unix:/tmp/shop.socket fail_timeout=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .section { | |
| border: 4px solid #fff; | |
| margin: 100px; | |
| padding: 10px 20px; | |
| overflow: hidden; | |
| width: 310px; | |
| background-image: -moz-linear-gradient(top, #f6f2ec, #e2dbce); /* FF3.6 */ | |
| background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #f6f2ec),color-stop(1, #e2dbce)); /* Saf4+, Chrome */ | |
| filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f6f2ec', EndColorStr='#e2dbce'); /* IE6,IE7 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Add a bookmark to this | |
| javascript:(function(){var c=document.getElementsByTagName("link");for(var d=0;d<c.length;d++){var a=c[d];if(a.rel=='stylesheet'||a.type=="text/css"){var e="css_buster_"+Math.floor(Math.random()*1000000000);var g=a.href.split("?",2);var f;if(g.length>1){var b=g[1].indexOf("&")==-1;if(b){f=e}else{f=g[1]+"&"+e}}else{f=e}a.href=g[0]+"?"+f}}})(); | |
| */ | |
| (function() { | |
| var links = document.getElementsByTagName('link'); | |
| for (var i = 0; i < links.length; i++) { | |
| var l = links[i]; | |
| if (l.rel == 'stylesheet' || l.type == 'text/css') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'rack' | |
| class Object | |
| def webapp | |
| class << self | |
| define_method :call do |env| | |
| func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
| [200, {}, send(func, *attrs)] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| def HtmlColorCode_to_strings(value): | |
| "Convert a HTML color code like '#FFCC00' or 'FFCC00' to a list of strings ['FF', 'CC', '00']" | |
| x = 1 * value.startswith('#') | |
| return [value[x:x+2],value[x+2:x+4],value[x+4:x+6]] | |
| def HtmlColorCode_to_ints(value): | |
| "Convert a HTML color code like '#FFCC00' or 'FFCC00' to a list of integers [255, 204, 0]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This requires a few configuration values to be set in order to know what | |
| # parameters to provide to ``couchapp``. | |
| # The default value to be sent as ``--docid`` to ``couchapp push`` | |
| DEFAULT_DOCID = "_design/awesome" | |
| # The default destination to be sent to ``couchapp push`` | |
| DEFAULT_DEST = "some_db" | |
| # Actual fabfile script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Run as a supervisor event listener process. See http://supervisord.org/events.html for more info. | |
| An example eventlistener config block looks like: | |
| [eventlistener:myeventhandler] | |
| command=python /path/to/eventriloquist.py | |
| events=EVENT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| brew install python boost exiv2 | |
| curl -O http://launchpadlibrarian.net/61465005/pyexiv2-0.3.0.tar.bz2 | |
| tar xjvf pyexiv2-0.3.0.tar.bz2 | |
| cd pyexiv2-0.3.0 | |
| # https://answers.launchpad.net/pyexiv2/+question/140742 | |
| echo "env['FRAMEWORKS'] += ['Python']" >> src/SConscript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| VENV=$1 | |
| if [ -z $VENV ]; then | |
| echo "usage: runinenv [virtualenv_path] CMDS" | |
| exit 1 | |
| fi | |
| . ${VENV}/bin/activate | |
| shift 1 | |
| echo "Executing $@ in ${VENV}" | |
| exec "$@" |