Skip to content

Instantly share code, notes, and snippets.

View dweinstein's full-sized avatar

David Weinstein dweinstein

View GitHub Profile
@dweinstein
dweinstein / gdbserver.sh
Last active August 22, 2023 12:25
Android gdb debug scripts for hooking native processes
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "usage: $(basename $0) <process>"
exit 1
fi
IP=$(adb shell netcfg | grep wlan0 | awk '{print $3}' | cut -d '/' -f1)
if [ $? -ne 0 ]; then
echo "device plugged in?"
exit 1
@dweinstein
dweinstein / android-tcpdump.sh
Last active July 21, 2023 23:40
Easier tcpdump setup for Android (make sure tcpdump binary is in /data/local/tmp/xbin/tcpdump). Assumes socat and wireshark are installed on your system and that you're on OS X. Easily tweaked for other platforms...
#!/usr/bin/env bash
TCPDUMP_PID=""
SOCAT_PID=""
OUTPUT_FILE=""
PORT=12345
TMPDIR="."
TCPDUMP_PATH="/data/local/tmp/xbin/tcpdump"
NETCAT_PATH="/data/local/tmp/nc"
HOST_INTERFACE="en0"
@dweinstein
dweinstein / README.md
Last active July 12, 2023 15:42
create git repositories and include project info for cgit

README

  • This script will generate a bare git repo in your current user's ${HOME} directory
  • it will query you for relevant info that the frontend (cgit) will use and dispay to users
  • it will make an initial README.md commit to the repository
  • this is intended to be used with this project https://github.com/dweinstein/minimal-cgi-server-for-cgit
    • basically this hosts cgit (http://git.zx2c4.com/cgit/) from a minimal python http server so you don't have to go setup lighthttp or apache.

Usage

@dweinstein
dweinstein / Dockerfile
Created March 14, 2014 15:37
testProject
FROM ubuntu
MAINTAINER David Weinstein <david@bitjudo.com>
# install our dependencies and nodejs
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install python-software-properties git build-essential
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get -y install nodejs
@dweinstein
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
dweinstein / android_direct.sh
Created November 19, 2014 18:42
iptable adb android
#!/bin/sh
set -x
PROXY_HOST=$(ifconfig en0 | grep "inet " | awk '{print $2}')
PROXY_PORT=8080
function adb_shell {
local cmd="$1"
adb shell "${cmd}"
}
@dweinstein
dweinstein / Dockerfile-nodejs
Last active June 29, 2022 16:59
Install node modules before copying over your working code so that node_modules are built (and cached) before you change your service code!
# ...
ADD package.json /tmp/package.json
RUN cd /tmp && npm install && \
mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/
# ...
WORKDIR /opt/app
ADD . /opt/app
@dweinstein
dweinstein / Data Mining Books.md
Last active May 25, 2022 16:37
Free Data Mining books

Source: http://christonard.com/12-free-data-mining-books/

  • An Introduction to Statistical Learning with Applications in R by James, Witten, Hastie & Tibshirani – This book is fantastic and has helped me quite a bit. It provides an overview of several methods, along with the R code for how to complete them. 426 Pages.
  • The Elements of Statistical Learning by Hastie, Tibshirani & Friedman – This is an in-depth overview of methods, complete with theory, derivations & code. I’d definitely consider this a graduate level text. I’d also consider it one of the best books available on the topic of data mining. 745 Pages.
  • A Programmer’s Guide to Data Mining by Ron Zacharski – This one is an online book, each chapter downloadable as a PDF. It’s also still in progress, with chapters being added a few times each year. Probabilistic Programming & Bayesian Methods for Hackers by Cam Davidson-Pilson – This book is absolutely fantastic. The author explains Bayesian statistics, provides several diverse examples of how to a
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 / dbg.h
Created November 14, 2013 20:00
debug macros for C/C++ and maybe JNI android development
#ifndef __dbg_h__
#define __dbg_h__
#include <stdio.h>
#include <errno.h>
#include <string.h>
// Debug tag
#define DTAG "DBG"