Skip to content

Instantly share code, notes, and snippets.

@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__':
@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 / configure.py
Last active August 29, 2015 14:05 — forked from anonymous/file1.txt
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'
#!/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): ",
@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
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 / 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>;
}
@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
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,
}