Skip to content

Instantly share code, notes, and snippets.

@alberthdev
alberthdev / AR.bt
Last active October 4, 2021 04:15
010 editor template - AR .a, .lib, .ar, .deb with Microsoft / Visual Studio (MSVC) specific parsing
//------------------------------------------------
//--- 010 Editor v11.0 Binary Template
//
// File: AR.bt
// Authors: SweetScape Software + Albert Huang (GitHub @alberthdev)
// Version: 1.1
// Purpose: Parse ar archives used for .a, .lib,
// .ar and .deb files.
// Category: Archive
// File Mask: *.a,*.lib,*.ar,*.deb
@alberthdev
alberthdev / bootstrap.sh
Created March 19, 2021 02:56
bootstrap.sh
#!/bin/bash
# This script aims to build a bootstrap CMake + gRPC environment for
# your project! It tries and saves space for the build - shallow cloning
# by default. Post build it'll take 1.5 GBs total, 340 MBs for just the
# final binaries needed for your project.
#
# magical bash snip @ https://stackoverflow.com/a/246128
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
becho() { echo -e "\e[1m$@\e[0m"; }
@alberthdev
alberthdev / libpng-apng-install-mac.sh
Last active January 12, 2018 04:39
Script to install libpng-apng on Mac OS X
#!/bin/bash
# CEmu libpng-apng Build Script
#
# Prerequisites:
# - BASH to run this script. (If you can run it, chances are that
# you have it!)
# - curl to download packages.
# - Basic UNIX utilities - sed, grep, sort, tar, rm
# - Clang/GCC + Make installed. For Mac OS X, you may get this
# installed via Xcode - see here:
@alberthdev
alberthdev / strdup_null.c
Created January 2, 2018 02:12
strdup testing
#include <stdio.h>
#include <string.h>
int main() {
char *null_ptr = NULL;
char *null_ptr_2 = NULL;
printf("Hi there! null_ptr is %p, null_ptr_2 is %p\n", (void *)null_ptr, (void *)null_ptr_2);
null_ptr_2 = strdup(null_ptr);
@alberthdev
alberthdev / gist:4f935f179b082c94893ea06f778d892c
Created March 26, 2017 07:25
directive.cpp w/ debug statements for crash
/* TEST INPUT:
* .addinstr 0 0 0000000000000000000000000000
*
* Save to crash.asm, and run (for extra fun):
* ./spasm crash.asm
* valgrind --leak-check=full ./spasm crash.asm
*
* This contains the bug fix - to remove it, search
* for "BUG FIX IS ON THE NEXT LINE", and comment out the
* following line.
@alberthdev
alberthdev / load_env.sh
Created January 31, 2017 17:09
Environment Loading Script
#!/bin/bash
# Environment Loading Script by alberthdev
# To use, run:
# source load_env.sh
APP="arm-eabi (32-bit) GCC Linaro"
CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
grepstr() { printf "$2" | grep "$1" 2>&1 >/dev/null; return $?; }
patherr() { echo "ERROR: Duplicate $1 path detected."; echo "You may already have this path loaded."; exit 1; }
@alberthdev
alberthdev / reset_wifi.sh
Created January 31, 2017 14:41
WiFi Reset Script (for Intel Wireless on Linux)
#!/bin/bash
# reset_wifi - WiFi Reset Script
# Copyright (C) 2014 Albert Huang.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@alberthdev
alberthdev / pyenv_prep.sh
Created October 29, 2016 17:01
Pyenv Prep
#!/bin/bash
# In order to use Pyenv, you do need a few dependencies to get things going.
# Otherwise, building will not occur and/or your favorite (necessary) modules
# won't be built!
# Install the basics (gcc, g++, make, etc.)
sudo apt-get install build-essential
# Python 3.5.2 build dependencies
# (Source from: http://mirrors.bloomu.edu/debian/pool/main/p/python3.5/python3.5_3.5.2-6.dsc)
@alberthdev
alberthdev / arduino_proj_2.c
Created May 3, 2016 05:24
Arduino code updated
// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the breakout example
#define BREAKOUT_RESET 9 // VS1053 reset pin (output)
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
#define BREAKOUT_DCS 8 // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield
@alberthdev
alberthdev / arduino_proj.c
Created May 2, 2016 04:34
Arduino Project Code
// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the breakout example
#define BREAKOUT_RESET 9 // VS1053 reset pin (output)
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
#define BREAKOUT_DCS 8 // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield