Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env bash
# https://github.com/mitsuhiko/pipsi
BOOTSTRAP_DIR=~/.local/venvs/__bootstrap
BOOTSTRAP_PKGS=$(cat <<EOF
virtualenv
EOF
)
@robo-corg
robo-corg / random game generator.ipynb
Created April 16, 2017 09:05
Random game generator
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
extern crate bytes;
extern crate futures;
extern crate tokio_io;
extern crate tokio_proto;
extern crate tokio_service;
use std::io::Result;
use std::error::Error;
use bytes::{BytesMut, BufMut};
use tokio_io::{AsyncRead, AsyncWrite};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robo-corg
robo-corg / Color Square Isolation.ipynb
Created January 28, 2016 20:57
Solves the isolate the color witness puzzles
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robo-corg
robo-corg / weather.15m.py
Last active January 6, 2016 18:51
forecast.io plugin for bitbar with fun emoji icons
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import forecastio
icon_to_emoji = {
'clear-day': u'☀️',
'clear-night': u'🌙',
'rain': u'🌧',
'snow': u'❄️',
{
init: function(elevators, floors) {
function optimizeDestinationQueue(elevator) {
queue = elevator.destinationQueue.sort();
console.log("starting queue: " + queue);
queue = queue.reduce(function (a, b) {
console.log("a: " + a);
if (a.indexOf(b) !== -1) {
return a;
}
#!/bin/bash
# Parameters
socket="$1"
dump="/tmp/capture.pcap"
# Extract repetition
port=9876
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig"
@robo-corg
robo-corg / embed_kernel_noloop.py
Created August 15, 2013 01:47
Returns a function that can used to manually pump IPython events to the embedded kernel instead of starting a blocking event-loop.
from IPython.kernel.zmq.kernelapp import IPKernelApp
from IPython.utils.frame import extract_module_locals
import sys
# Code lifted from IPython/kernel/zmq/embed.py
def embed_kernel_noloop(module=None, local_ns=None, **kwargs):
"""Embed and start an IPython kernel in a given scope
returning function that can be used to pump a single event
Parameters