Skip to content

Instantly share code, notes, and snippets.

@MartinMReed
MartinMReed / ddwrt-vpn
Last active October 26, 2019 18:24
VPN Routing, DD-WRT Startup Script
#!/bin/sh
#
# https://ipinfo.io/ASXXXXX
# https://ipinfo.io/countries/us
# curl https://api.hackertarget.com/aslookup/?q=example
set -e
default_iface=$(route | grep default | sed -n "s/^default .* \(.*\)$/\1/p")
vpn_iface=ppp0
@MartinMReed
MartinMReed / aosp.sh
Last active October 16, 2019 01:33
Compile AOSP (Android Open Source Project) on macOS
#! /bin/sh
#
# Build directory:
BUILD_DIRECTORY=~/Desktop
#
#
#
# Each build of AOSP is tied to a specific source tag. You can find the match between the
# build number and source tag from the link below. If you choose a tag that does not properly
# match with the build number, you will receive a warning prompt when running this script.
@MartinMReed
MartinMReed / openssl_client.c
Last active December 29, 2022 17:19
OpenSSL Client, Reference Example
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#define HOST "encrypted.google.com"
/**
* Example SSL client that connects to the HOST defined above,
* and prints out the raw response to stdout.
*/
@MartinMReed
MartinMReed / icu_android.sh
Last active August 11, 2022 22:05
Compile ICU for Android NDK
#!/bin/sh
NDK_ROOT=/tools/android/android-ndk-r6b
NDK_TOOLCHAIN_BIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin
SDK_ROOT=$NDK_ROOT/platforms/android-8/arch-arm
ICU_PATH=/Users/mreed/Desktop/icu
ICU_FLAGS="-I$ICU_PATH/source/common/ -I$ICU_PATH/source/tools/tzcode/"
export CPPFLAGS="--sysroot=$SDK_ROOT -D__STDC_INT64__ $ICU_FLAGS -I$SDK_ROOT/usr/include/ -I$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/include/ -I$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/"
export LDFLAGS="--sysroot=$SDK_ROOT -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/libs/armeabi/"
@MartinMReed
MartinMReed / openssl_server.c
Last active December 29, 2022 17:19
OpenSSL Server, Reference Example
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <string>
#include <sys/socket.h>
#include <netinet/in.h>
#define IP_ADDR INADDR_ANY