Skip to content

Instantly share code, notes, and snippets.

View dweinstein's full-sized avatar

David Weinstein dweinstein

View GitHub Profile
#!/usr/bin/env bash
client_dir=client-$1
if [ -z $1 ]; then
echo "must pass the client name"
exit
fi
if [ ! -d $1 ]; then
mkdir $client_dir
../configure --enable-linux-user --python=/usr/bin/python2 --target-list="armeb-linux-user arm-linux-user" --prefix=${HOME}/local
```bash
$ cat - > /etc/tmpfiles.d/resolv.conf
f /tmp/resolv.conf 755 root root -
EOF
$ touch /tmp/resolv.conf
$ ln -sf /tmp/resolv.conf /etc/resolv.conf
```
@dweinstein
dweinstein / gist:6379461
Last active December 21, 2015 22:59
archlinux arm fstab file using read-only root
/dev/root / ext3 ro,relatime,user_xattr,barrier=1,nodelalloc,data=ordered 0 0
ramfs /tmp ramfs defaults,noatime,mode=1777 0 0
ramfs /var/cache/pacman tmpfs defaults,noatime,nosuid,nodev,size=128M 0 0
ramfs /var/log ramfs defaults,noatime,mode=1777 0 0
ramfs /var/tmp ramfs defaults,noatime,mode=1777 0 0
ramfs /home/user/filerelay ramfs defaults,noatime,mode=1777 0 0
@dweinstein
dweinstein / dbg.h
Last active December 26, 2015 10:39
Error handling macros for C
#ifndef __dbg_h__
#define __dbg_h__
#include <stdio.h>
#include <errno.h>
#include <string.h>
#ifdef NDEBUG
#define debug(M, ...)
#else
@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"
@dweinstein
dweinstein / Makefile
Created November 15, 2013 18:21
Android standalone native makefile
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(NDK_DIR)),)
$(error "set NDK_DIR in your environment. export NDK_DIR=<path to android-ndk-r8e>")
endif
#determine OS string
@dweinstein
dweinstein / build.gradle
Last active June 1, 2018 02:48
Gradle build files for Android native library development
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
@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 / 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