Skip to content

Instantly share code, notes, and snippets.

@luser
luser / Image2Map.py
Last active October 24, 2019 18:52 — forked from bjorn/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 / irccexport.py
Last active January 3, 2018 21:00 — forked from dpk/irccexport.py
Quick-and-dirty IRCCloud log export tool
#!/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
@luser
luser / playground.rs
Last active May 22, 2017 16:45 — forked from anonymous/playground.rs
Zero-copy struct referencing with alignment checks
use std::borrow::Cow;
use std::mem;
use std::ptr;
use std::slice;
#[derive(Clone)]
struct S {
pub x: u32,
}
@luser
luser / playground.rs
Last active June 10, 2016 15:16 — forked from anonymous/playground.rs
Rust enum with attached strings
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 / processed_crash_schema.json
Last active June 1, 2016 16:17 — forked from adngdb/processed_crash_schema.json
Socorro's Processed Crash Schema
{
"$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
Created May 27, 2016 11:15 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::marker::PhantomData;
use std::boxed::Box;
trait Data {
fn get(&self) -> u32;
}
trait DataCreator {
fn new_data() -> Box<Data>;
}
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 / dump.c
Last active December 16, 2015 16:19 — forked from anonymous/dump.c.txt
#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;
}
@luser
luser / gist:2829765
Created May 29, 2012 17:58 — forked from pnasrat/gist:935329
bob's install-name-tool.py
import macholib
def install_name_tool(fn, new_id=None, changedict=None):
m = macholib.MachO(fn)
if new_id:
m.rewriteInstallNameCommand(new_id)
if changedict:
m.rewriteLoadCommands(changedict)
m.save()
if __name__ == '__main__':
#!/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): ",