Skip to content

Instantly share code, notes, and snippets.

💭
Mostly on gitlab.com/dweinstein these days...

David Weinstein dweinstein

💭
Mostly on gitlab.com/dweinstein these days...
Block or report user

Report or block dweinstein

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dweinstein
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
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
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 https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/USBBook/index.html
//
// *Important* If your application is sandboxed, it must request the
@dweinstein
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.
Permission:android.permission.CHANGE_WIFI_STATE
719 Callers:
<com.android.server.NetworkManagementService: void startAccessPoint(android.net.wifi.WifiConfiguration,java.lang.String,java.lang.String)> (2)
<android.os.INetworkManagementService$Stub$Proxy: void startAccessPoint(android.net.wifi.WifiConfiguration,java.lang.String,java.lang.String)> ()
<android.os.INetworkManagementService$Stub: void startAccessPoint(android.net.wifi.WifiConfiguration,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(android.net.wifi.WifiConfiguration,java.lang.String,java.lang.String)> (1)
<com.android.server.NetworkManagementService: boolean onTransact(int,android.os.Parcel,android.os.Parcel,int)> (2)
<android.net.wifi.WifiStateMachine: boolean startSoftApWithConfig(android.net.wifi.WifiConfiguration)> (1)
@dweinstein
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 10.0.1.1, 8.8.8.8;
View Inline assembly, GCC.txt
http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
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
dweinstein / Samsung_git_repos
Created Apr 19, 2013
Samsung git repositories
View Samsung_git_repos
-- Galaxy S3 -- git://opensource.samsung.com/SHV-E210S
-- Galaxy Note II -- git://opensource.samsung.com/GT-N7100
View 0001-add-HID-support-to-android-gadget.patch
From c5a7d1115318bd02145a4b41109464d564b37af9 Mon Sep 17 00:00:00 2001
From: David Weinstein <dweinst@insitusec.com>
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
dweinstein / uri.sh
Created Aug 22, 2013
uri.sh extracts URLs from apks statically with minimum fuss
View uri.sh
#!/usr/bin/env bash
if [ ! -d `basename $1 .apk` ]; then
apktool d $1
fi
find ./`basename $1 .apk` -name '*.smali' -exec grep -o '"https\?://[^"]*"' {} \;
You can’t perform that action at this time.