Skip to content

Instantly share code, notes, and snippets.

@rogerhub
rogerhub / sman
Last active October 29, 2015 01:29
A simple sync manager (depends on rsync, fswatch, python)
#!/usr/bin/env python2.7
import json
import logging
import multiprocessing
import os
import signal
import socket
import struct
import subprocess
@rogerhub
rogerhub / sgdf-graph.py
Created December 8, 2015 09:02
Running time graph for SGDF.
from sgdf.fusion.alternatives.reference import *
from sgdf.fusion.alternatives.quickdescent import *
from sgdf.benchmarking.headless import *
import time
def b(algorithm, n):
mask = np.zeros((n, n), dtype=np.bool)
mask[n/4:3*n/4, n/4:3*n/4] = True
source = np.random.random((n, n, 3)).astype(np.float32)
@rogerhub
rogerhub / gist:4761345
Created February 12, 2013 10:06
Latest parsecss function
roger@melchior [~/Staging/main-theme]$ php5 -a
Interactive shell
php > include("colors.php");
php > print_r(DC_Colors::parsecss('rgba(32, 51, 41, 0.3)'));
Array
(
[0] => 32
[1] => 51
[2] => 41
@rogerhub
rogerhub / airbearsautologin.java
Created March 12, 2013 04:25
AirBears Automatic Login in Java
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;
class AirBearsAutoLogin {
// Published URLs that SHOULD not change.
public static String google = "http://www.google.com/generate_204";
public static String airbears = "https://wlan.berkeley.edu/cgi-bin/login/calnet.cgi";
@rogerhub
rogerhub / youtube-ratings-preview-addon-sdk-diff
Last active January 3, 2016 18:09
A full list of differences between the official Mozilla Jetpack Firefox Addons SDK version 1.14 (legacy) and the Addons SDK bundled with the Youtube Ratings Preview Addon for Firefox.
./windows/tabs-fennec.js
11c11,12
< const { openTab, getTabs, getSelectedTab, getTabForBrowser: getRawTabForBrowser } = require('../tabs/utils');
---
> const { openTab, getTabs, getSelectedTab, getTabForBrowser: getRawTabForBrowser,
> getTabContentWindow } = require('../tabs/utils');
21,22c22,23
< const { isPrivateBrowsingSupported } = require('sdk/self');
< const { isTabPBSupported } = require('sdk/private-browsing/utils');
---
timer ticks | R(A) | R(B) | R(C) | P(A) | P(B) | P(C) | thread to run
------------|------|------|------|------|------|------|--------------
0 | | | | | | |
4 | | | | | | |
8 | | | | | | |
12 | | | | | | |
16 | | | | | | |
20 | | | | | | |
24 | | | | | | |
28 | | | | | | |
@rogerhub
rogerhub / Outage.md
Last active March 4, 2016 09:01
RogerHub Monday 12/7/2015 Outage

RogerHub Monday 12/7/2015 Outage

The Final Grade Calculator was broken from approximately 2:21AM PST to 11:22AM PST (9 hours 1 minute) on December 7th 2015.

Root cause

The JavaScript for the Final Grade Calculator was out of date.

@rogerhub
rogerhub / gist:7855c727d5ce284eedf2
Created January 17, 2016 06:07
Duplicity 0.7.06 segmentation fault with librsync 2.0.0 on OS X

(January 16, 2016) I encounted a segmentation fault in the function rs_search_for_block of librsync while running the Duplicity backup tool. This crash appears to be related to this bug.

In the meantime, I used the following commands to switch back to old versions of librsync and duplicity:

brew switch librsync 0.9.7
brew switch duplicity 0.6.26_1
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
@rogerhub
rogerhub / pandagrader.user.js
Created October 4, 2014 23:19
Change 'Gradescope' back to 'Pandagrader'
// ==UserScript==
// @name Change gradescope to pandagrader
// @namespace http://rogerhub.com/
// @version 0.1
// @match https://www.gradescope.com/*
// @run-at document-end
// ==/UserScript==
document.title = document.title.replace("Gradescope", "Pandagrader");