Skip to content

Instantly share code, notes, and snippets.

View jhandley's full-sized avatar

Josh Handley jhandley

  • Teleyah Technology
View GitHub Profile
#!/bin/bash
# Download and build libcurl, openssl and zlib for Android using Crystax NDK r7
# Must be run on 32 bit Linux as the Crystax r7 NDK doesn't support 64 bit hosts
# Tested on Ubuntu 14.04
# Make the working directory
mkdir curl-android-build
cd curl-android-build
ROOT_DIR=`pwd -P`
@jhandley
jhandley / fix_include_case.py
Created August 24, 2019 13:00
Fix case of filenames in #include statements in C/C++ source code
#!/usr/bin/python
import sys, re, os, fnmatch, collections, string, chardet
REGEX_INCLUDE_FILE = re.compile(r"\s*(?:#include\s*\"([^\"]+)\")|\s*(?:#include\s*\<([^\"]+)\>)")
def fixcase(path):
(dirname, filename) = os.path.split(path)
if dirname and filename:
try:
fixed_filename = [f for f in os.listdir(dirname) if f.lower() == filename.lower()][0]
@jhandley
jhandley / change_file_encodings.py
Last active August 24, 2019 13:02
Change character encodings of a bunch of C++ source files
#!/usr/bin/python
import sys, os, chardet
def main(argv):
if len(argv) < 3:
print("Usage: " + argv[0] + " <directory> encoding")
sys.exit(2)
root_dir = argv[1]
target_encoding = argv[2]
@jhandley
jhandley / webview2.nsh
Last active September 28, 2024 05:29
Install Webview2 runtime with NSIS
# Install webview2 by launching the bootstrapper
# See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
Function installWebView2
# If this key exists and is not empty then webview2 is already installed
ReadRegStr $0 HKLM \
"SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${If} ${Errors}
${OrIf} $0 == ""