Skip to content

Instantly share code, notes, and snippets.

View dweinstein's full-sized avatar

David Weinstein dweinstein

View GitHub Profile
dweinstein / cdr.c
Created June 7, 2011 22:04
seek's stream or file before outputting to stdout
/* cdr.c
* David Weinstein (2011)
* offset bytes into a file and write to stdout
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
dweinstein / accessory.h
Created August 20, 2012 00:43
header file for android accessory mode
// accessory.h
// AccessoryMode
// Created by David Weinstein on 8/3/12.
// Copyright (c) 2012 David Weinstein. All rights reserved.
#ifndef AccessoryMode_accessory_h
#define AccessoryMode_accessory_h
dweinstein / main.cpp
Created August 20, 2012 01:32
main function for interacting with accessory protocol
// main.cpp
// AccessoryMode
// Created by David Weinstein on 07/30/2012.
// Copyright (c) 2012 David Weinstein. All rights reserved.
// Code based on documentation from apple: Working With USB Device Interfaces
// see
// *Important* If your application is sandboxed, it must request the
dweinstein / template.txt
Created September 5, 2012 20:42
my org-mode template for exporting to LaTeX/PDF
#+TITLE: Template org-mode document for export to LaTeX/PDF
#+AUTHOR: David Weinstein
#+LaTeX_HEADER: \usepackage[left=1in,top=1in,right=1in,bottom=1.5in]{geometry}
#+LaTeX_HEADER: \usepackage{palatino}
#+LaTeX_HEADER: \usepackage{fancyhdr}
#+LaTeX_HEADER: \usepackage{sectsty}
#+LaTeX_HEADER: \usepackage{engord}
#+LaTeX_HEADER: \usepackage{cite}
#+LaTeX_HEADER: \usepackage{graphicx}
dweinstein / ics_allmappings.txt
Created November 5, 2012 17:57
PScout ICS All Mapings
This file has been truncated, but you can view the full file.
719 Callers:
< void startAccessPoint(,java.lang.String,java.lang.String)> (2)
<android.os.INetworkManagementService$Stub$Proxy: void startAccessPoint(,java.lang.String,java.lang.String)> ()
<android.os.INetworkManagementService$Stub: void startAccessPoint(,java.lang.String,java.lang.String)> (2)
<android.os.INetworkManagementService$Stub: boolean onTransact(int,android.os.Parcel,android.os.Parcel,int)> (2)
<android.os.INetworkManagementService: void startAccessPoint(,java.lang.String,java.lang.String)> (1)
< boolean onTransact(int,android.os.Parcel,android.os.Parcel,int)> (2)
< boolean startSoftApWithConfig(> (1)
< boolean access$14000(andro
dweinstein / dhcpd.conf
Last active August 1, 2018 06:10
wireless ethernet NAT'd join (internet sharing) for my laptop running ArchLinux. This is so I can connect a desktop to my wireless network via laptop wifi. The desktop is assumed to use dhcp to get an IP address. Therefore, this script assumes that /etc/dhcpd.conf is configured with an appropriate subnet, and that /etc/conf.d/dhcp (on archlinux)…
# dhcpd.conf
# configuration file for dhcpd, which I generally use
# when NAT'ing wifi/ethernet for internet sharing.
# intended for /etc/dhcpd.conf
# option definitions common to all supported networks...
option domain-name "local.";
option domain-name-servers,;
dweinstein / Inline assembly, GCC.txt
Created April 4, 2013 14:21
Inline assembly GCC
6.41 Assembler Instructions with C Expression Operands
In an assembler instruction using asm, you can specify the operands of the instruction using C expressions. This means you need not guess which registers or memory locations will contain the data you want to use.
You must specify an assembler instruction template much like what appears in a machine description, plus an operand constraint string for each operand.
For example, here is how to use the 68881's fsinx instruction:
asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
Here angle is the C expression for the input operand while result is that of the output operand. Each has `"f"' as its operand constraint, saying that a floating point register is required. The `=' in `=f' indicates that the operand is an output; all output operands' constraints must use `='. The constraints use the same language used in the machine description (see Constraints).
dweinstein / Samsung_git_repos
Created April 19, 2013 14:10
Samsung git repositories
-- Galaxy S3 -- git://
-- Galaxy Note II -- git://
From c5a7d1115318bd02145a4b41109464d564b37af9 Mon Sep 17 00:00:00 2001
From: David Weinstein <>
Date: Mon, 14 Jan 2013 12:21:37 -0500
Subject: [PATCH] add HID support to android gadget.
drivers/usb/gadget/android.c | 189 ++++++++++++++++++++++++++++++++++++++++++
drivers/usb/gadget/f_hid.c | 8 +-
2 files changed, 194 insertions(+), 3 deletions(-)
dweinstein /
Created August 22, 2013 18:20 extracts URLs from apks statically with minimum fuss
#!/usr/bin/env bash
if [ ! -d `basename $1 .apk` ]; then
apktool d $1
find ./`basename $1 .apk` -name '*.smali' -exec grep -o '"https\?://[^"]*"' {} \;