Skip to content

Instantly share code, notes, and snippets.

Mostly on these days...

David Weinstein dweinstein

Mostly on these days...
View GitHub Profile
dweinstein / cdr.c
Created Jun 7, 2011
seek's stream or file before outputting to stdout
View cdr.c
/* 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 Aug 20, 2012
header file for android accessory mode
View accessory.h
// 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 Aug 20, 2012
main function for interacting with accessory protocol
View main.cpp
// 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 Sep 5, 2012
my org-mode template for exporting to LaTeX/PDF
View template.txt
#+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}
View ics_allmappings.txt
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)
dweinstein / dhcpd.conf
Last active Aug 1, 2018
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)…
View dhcpd.conf
# 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,;
View Inline assembly, GCC.txt
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 Apr 19, 2013
Samsung git repositories
View Samsung_git_repos
-- Galaxy S3 -- git://
-- Galaxy Note II -- git://
View 0001-add-HID-support-to-android-gadget.patch
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 Aug 22, 2013 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\?://[^"]*"' {} \;