Skip to content

Instantly share code, notes, and snippets.

@rogerhub
rogerhub / password_gen.rb
Created September 27, 2011 01:58
Password generator for Clark w/ default salt built in
View password_gen.rb
require 'digest/sha2'
adjectives = %w[red orange blue green purple big small wide thin gray long dark high low white smooth cool hot dusty sticky furry nice mean rich poor yellow sad happy ]
nouns = %w[book ruler kleenex glasses wand scissors stapler eraser drive car truck road basketball skateboard statue box square circle tree grass flower plant rose ]
500.times do
password = adjectives[rand(adjectives.size)] + nouns[rand(nouns.size)] + rand(10).to_s
puts password + "\t" + Digest::SHA512.hexdigest(password + "thisGETSridOFrainbowTABLES")
end
@rogerhub
rogerhub / gist:4761345
Created February 12, 2013 10:06
Latest parsecss function
View gist:4761345
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
View airbearsautologin.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 / monthname.php
Created January 7, 2014 21:03
Enables the %monthcode% and %monthname% tag for permalinks in WordPress.
View monthname.php
<?php
/**
* Plugin Name: Month Name
* Description: Enables the <code>%monthcode%</code> and <code>%monthname%</code> tag for Permalinks.
* Author: Roger Chen
* License: GPLv2
*/
/**
* Enables use of monthname (january, june) and monthcode (jan, jun).
@rogerhub
rogerhub / edmonds.py
Created January 9, 2014 22:16
An implementation of Edmond's Blossom Algorithm.
View edmonds.py
#!/usr/bin/env python
class Vertex:
def __init__(self, value):
self.value = value
self.edges = {}
def degree(self):
return len(self.edges)
def __str__(self):
return str(self.value)
@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.
View youtube-ratings-preview-addon-sdk-diff
./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');
---
@rogerhub
rogerhub / example.xml
Created February 9, 2014 01:35
An example import for Disqus.
View example.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<item>
<!-- title of article -->
@rogerhub
rogerhub / bitbucket.user.js
Last active July 8, 2022 15:41
UI enhancements for Bitbucket.org
View bitbucket.user.js
// ==UserScript==
// @name Bitbucket UI Enhancement
// @namespace http://rogerhub.com/
// @version 0.1
// @match https://bitbucket.org
// @run-at document-end
// ==/UserScript==
var style_element = document.createElement('style');
style_element.setAttribute('type', 'text/css');
@rogerhub
rogerhub / pandagrader.user.js
Created October 4, 2014 23:19
Change 'Gradescope' back to 'Pandagrader'
View pandagrader.user.js
// ==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");
View download_piazza_resoures.js
var k = document.getElementsByClassName("resource_title");
for (var i = 0; i < k.length; i++) { console.log(k[i].href); }