Skip to content

Instantly share code, notes, and snippets.

Avatar

Ted Mielczarek luser

View GitHub Profile
View Image2Map.py
# Filename : Image2Map.py
# Authors : Georg Muntingh and Bjorn Lindeijer
# Version : 1.2
# Date : June 16, 2010
# Copyright : Public Domain
import os, sys, networkx
from PIL import Image
class TileMap:
@luser
luser / playground.rs
Last active May 22, 2017 — forked from anonymous/playground.rs
Zero-copy struct referencing with alignment checks
View playground.rs
use std::borrow::Cow;
use std::mem;
use std::ptr;
use std::slice;
#[derive(Clone)]
struct S {
pub x: u32,
}
@luser
luser / processed_crash_schema.json
Last active Jun 1, 2016 — forked from adngdb/processed_crash_schema.json
Socorro's Processed Crash Schema
View processed_crash_schema.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "schema of a processed crash from Socorro",
"definitions": {
"frames": {
"type": "object",
"properties": {
"frame": {
"type": "integer",
@luser
luser / playground.rs
Last active Jun 10, 2016 — forked from anonymous/playground.rs
Rust enum with attached strings
View playground.rs
use std::slice::Iter;
use std::collections::HashSet;
trait EnumValues : Sized {
fn values() -> Iter<'static, Self>;
}
macro_rules! simple_enum {
($name:ident { $(($item:ident, $repr:expr),)* }) => {
#[derive(Debug)]
@luser
luser / playground.rs
Created May 27, 2016 — forked from anonymous/playground.rs
Shared via Rust Playground
View playground.rs
use std::marker::PhantomData;
use std::boxed::Box;
trait Data {
fn get(&self) -> u32;
}
trait DataCreator {
fn new_data() -> Box<Data>;
}
View symbolsproxyendpoint.py
def get(request):
debug_id = request.get('debug_id')
debug_filename = request.get('debug_filename')
if might_be_on_msdn(debug_id, debug_filename):
symbol_from_msdn = fetch_from_msdn(debug_id, debug_filename)
if not symbol_from_msdn:
raise PageNotFound()
else:
new_s3_key = upload_to_symbols_m_o_S3(symbol_from_msd)
return PageOK(new_s3_key.absolute_url)
@luser
luser / irccexport.py
Last active Jan 3, 2018 — forked from dpk/irccexport.py
Quick-and-dirty IRCCloud log export tool
View irccexport.py
#!/usr/bin/env python3
# Run this like:
# ircexport.py <email> <password> <log directory>
import requests
import json
import sys
from collections import deque
from concurrent.futures import ThreadPoolExecutor as Pool
from datetime import datetime
View get_artwork.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
import urllib, urllib2
import json
import shutil
MOVIES = {
'title_prompt': "Search for a movie title (or type 'tv' to switch to TV Shows): ",
View configure.py
import argparse
import fnmatch
import os
import string
import subprocess
import sys
from collections import defaultdict
SUBSTS = set(['MOZ_PERMISSIONS', 'MOZ_DMD', 'HAVE_64BIT_BUILD', 'MOZ_CAN_RUN_PROGRAMS', 'MOZ_WIDGET_TOOLKIT', 'MOZ_PNG_ARM_NEON_CHECK', 'MOZ_ALLOW_HEAP_EXECUTE_FLAGS', 'AR_EXTRACT', 'TAR', 'MOZ_SERVICES_COMMON', 'MOZ_VPX_ERROR_CONCEALMENT', 'ZLIB_IN_MOZGLUE', 'MOZ_JPROF', 'MOZ_SOCIAL', 'NONASCII', 'MOZ_MULET', 'VPX_ASFLAGS', 'MOZ_APP_ID', 'MOZ_NO_EV_CERTS', 'MOZ_PNG_CFLAGS', 'MOZ_CHILD_PROCESS_NAME', 'MOZ_OPUS', 'OBJCOPY', 'ASM_SUFFIX', 'MOZ_WEBSPEECH', 'MOZ_FIX_LINK_PATHS', 'GRE_MILESTONE', 'HOST_LDFLAGS', 'VISIBILITY_FLAGS', 'TARGET_MD_ARCH', 'MOZ_ASAN', 'MOZ_APP_UA_NAME', 'GST_API_VERSION', 'MOZ_DEVICES', 'MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS', 'MOZ_SERVICES_HEALTHREPORT', 'MOZ_JPEG_CFLAGS', 'MOZ_B2G_FM', 'MOZ_B2G_RIL', 'MOZ_ANDROID_OMTC', 'MOZ_METRO', 'DSO_LDOPTS', 'MOZ_OPTIMIZE_LDFLAGS', 'MOZ_DISABLE_PARENTAL_CONTROLS', 'OS_LDFLAGS', '_MSC_VER', 'MKSHLIB_FORCE_ALL', 'MOZ_NUWA_PROCESS'
View dump.c
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int test(int x, int y) {
return x + y - x * y;
}
int end() {
return 0;
}