Skip to content

Instantly share code, notes, and snippets.

View crizCraig's full-sized avatar
🛰️
Journeying through levels of abstraction trying to land

Craig Quiter crizCraig

🛰️
Journeying through levels of abstraction trying to land
View GitHub Profile
{"kind": "Listing", "data": {"modhash": "0h2ailm0sf73b753219e8695a84f661c5fb5ef47350859c969", "children": [{"kind": "t3", "data": {"domain": "carlcheo.com", "banned_by": null, "media_embed": {}, "subreddit": "programming", "selftext_html": null, "selftext": "", "likes": null, "user_reports": [], "secure_media": null, "link_flair_text": null, "id": "30sz09", "gilded": 0, "archived": false, "clicked": false, "report_reasons": null, "author": "vaguepotato", "num_comments": 127, "score": 698, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2fwo", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 0, "secure_media_embed": {}, "saved": false, "stickied": false, "is_self": false, "permalink": "/r/programming/comments/30sz09/24_years_ago_linus_torvalds_said_linux_is_just_a/", "name": "t3_30sz09", "created": 1427751242.0, "url": "http://carlcheo.com/fascinating-posts-from-tech-founders-who-changed-the-world", "author_flair_text": null, "
var devsite = devsite || {};
devsite.devsite = devsite.devsite || {};
$(document).ready(function() {
$("a.sign-in-link").bind("mousedown click", devsite.devsite.login);
$("a.sign-out-link").bind("mousedown click", devsite.devsite.logout);
devsite.devsite.loggedIn(function(d, b) {
b ? devsite.devsite.showError("Error while signing in: " + b) : $("#sign-in-io").hasClass("trig") && devsite.reloadWindow()
})
});
window.IO_2012 = function() {
def deletedbandmemcache():
"""Delete all entities in namespace."""
from google.appengine.api import namespace_manager
######################################
""" ####### IMPORTANT ########## """
TESTSPACE = 'test'
namespace_manager.set_namespace(TESTSPACE)
""" ##### DO NOT DELETE ######## """
######################################
synonyms = {'scotty': 'dog', 'puppy': 'dog', 'dog': 'dog'}
counts = [(2, 'dog'), (2, 'puppy'), (2, 'scotty')]
syn_counts = []
for count in counts:
syn_counts.append((count[0], synonyms[count[1]]))
print syn_counts
sum_counts = {}
@crizCraig
crizCraig / gist:2661613
Created May 11, 2012 18:40
Mobile webkit events
// DOM methods & attributes for Document
DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
DEFINE_ATTRIBUTE_EVENT_LISTENER(click);
DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu);
DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick);
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter);
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover);
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave);
@crizCraig
crizCraig / basemodel.py
Created July 14, 2012 21:51
GAE Sharded counter
class BaseShardedCountModel(BaseModel):
# services
# - in-memory counts
# - getting counter name from entity
# - check for transition
def counter(self, name):
from lib.shardedcounter import Counter
return Counter(str(name + '_' + str(self.key().id())))
def getshardedcount(self, name):
# Load the system properties
system=[method://java.lang.System.getProperties()]
# Define the environment and language based on the system properties,
# with sensible defaults.
# (these likely came in as -D options on the command line)
lang=${system->lang|english}
env=${system->env|dev}
# Include language based properties
@crizCraig
crizCraig / graph_losses.py
Last active March 18, 2016 00:58
plotly offline scatter
import plotly
from plotly.graph_objs import Scatter, Layout
plotly.offline.plot({
"data": [
Scatter(x=times, y=losses)
],
"layout": Layout(
title="loss over time"
)
})
@crizCraig
crizCraig / good_files.json
Created September 16, 2016 20:57
Clean DeepDrive files
[
0,
1,
2,
3,
4,
5,
6,
10,
11,
@crizCraig
crizCraig / deepdrive.py
Last active November 4, 2016 21:29
DeepDrive.io image parsing
SIZE = 227
def show_image_read_from_hdf5_file(img):
from skimage.viewer import ImageViewer
img = np.array(img, dtype='u1')
img = img.transpose((1, 2, 0))
img = img[:, :, ::-1]
viewer = ImageViewer(img.reshape(SIZE, SIZE, 3))
viewer.show()