Skip to content

Instantly share code, notes, and snippets.

View edwindotcom's full-sized avatar
:octocat:
hubba hubba

Edwin Wong edwindotcom

:octocat:
hubba hubba
  • Alameda, CA
View GitHub Profile
from bottle import route, run, get, post, request, redirect, static_file
import json
import os
import sys
from os import listdir
from os.path import isfile, join
# if not os.environ.has_key("IMG_ROOT"):
# print 'need IMG_ROOT env set'
#!/usr/bin/env ruby
require "webrick"
=begin
WEBrick is a Ruby library that makes it easy to build an HTTP server with Ruby.
It comes with most installations of Ruby by default (it’s part of the standard library),
so you can usually create a basic web/HTTP server with only several lines of code.
The following code creates a generic WEBrick server on the local machine on port 1234,
#!/usr/bin/python
import json
from pprint import pprint
import sys
sys.setrecursionlimit(1500)
def loadJson(json_file):
with open(json_file) as jdata:
data = json.load(jdata)
#!/usr/bin/python
#
# usage: python extract_sample.py <url>
import requests
import json
import sys
import time
from pprint import pprint
#!/usr/bin/python2.7 -S
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# pip install jws
# pip install python-jose
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@edwindotcom
edwindotcom / diff_lists.py
Last active January 28, 2016 18:31
Takes two files and strips bad chars, spaces and diffs lists
'''
Takes two files and strips bad chars, spaces and diffs lists
Usage: python diff_lists.py new.txt old.txt
Example:
:: new.txt ::
len: 14
['1044530', '1179274', '1184663', '1191162', '1195569', '1210586', '1221294', '1224056', '1226094', '1236372', '1237824', '1239042', '1241141', '1241851']
:: old.txt ::
len: 15
function sendMsgToSW(){
sendMessage({
command: 'helloWorld',
url: 'foo'
}).then(function() {
// If the promise resolves, just display a success message.
writeLog('postMessage promise returned');
}).then(function(val){
writeLog(val);
}).catch(console.error);
user_pref("services.universalSearch.frameURL", "https://localhost:8080/");
user_pref("services.universalSearch.baseURL", "https://localhost:8080/index.html");
@edwindotcom
edwindotcom / gist:0db36eaa5d5cea0a036e
Last active August 29, 2015 14:07
get base image value from kk b2g builds
# for Kitkat base images:
adb shell getprop ro.bootloader
# for pre Kitkat base images:
adb shell getprop t2m.sw.version
function loadPage(address, route, lang){
page.customHeaders = {'accept-language': lang};
var address = url + route;
var docLocator;
var fxaHeader;
if (page === 'signup'){
docLocator = 'sign-up';
fxaHeader = "fxa-signup-header";
}else if(page === 'signin'){