Skip to content

Instantly share code, notes, and snippets.

View stonegray's full-sized avatar

stonegray stonegray

View GitHub Profile
services:
mosquitto:
image: eclipse-mosquitto
container_name: mosquitto
restart: unless-stopped
labels:
- "docker-compose-watcher.watch=1"
- "docker-compose-watcher.dir=."
volumes:
@stonegray
stonegray / quick-esp-idf.sh
Created March 3, 2022 09:40
esp-idf quick install (macOS)
# Quick install script for esp-idf
# Should you be using the Docker container instead?
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
brew install python3 cmake ninja dfu-util
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
@stonegray
stonegray / ghidra.md
Created January 25, 2022 15:21
Fixing Ghidra on macOS

Fixing Ghidra on macOS

The NSA does not sign Ghidra binaries, and has no plans to do so. Instead, they suggest that you install a build enviroment and rebuild these components from source.

Ghidra already ships with all required binaries for Intel macOS, so we can simply remove them from quarantine instead of replacing them. This will not work on aarch64 (M1 or A-series), for which you will need to do a rebuild.

The solution:

For new installs using brew:

@stonegray
stonegray / eval.js
Last active May 9, 2022 11:42
Evil Eval()
<!-- ~~~~~~~~~~~~~~~~~~~~ -->
/$$ Stones Evil Eval() $$/
<!-- ~~~~~~~~~~~~~~~~~~~~ -->
/*
* This file implements an alternate version of the builtin eval();
* function. Please note this is known to crash some parsers. (fixed
* in latest versions)
*
* If this loads missing indentation on GitHub, just reload the page.
@stonegray
stonegray / EC2 NVMe device name.md
Created May 12, 2020 13:16
Bash get AWS EC2 NVMe storage device name

There's no immedialy obvious way to determine which block device is definitely an AWS ephemeral storage device, so this quick snippet will grab it.

No error checking, so if you don't actually have an ephemeral storage device it will return the string "/dev/".

EPHEMERAL_STORAGE=/dev/$(lsblk -o +MODEL |grep "EC2 NVMe Instance Storage" | sed "s/ .*//")
# Get ephemereral storage device by block model data:
@stonegray
stonegray / brackets.js
Last active July 31, 2019 05:58
Obfuscated JS practice: Matching bracket pairs
/* brackets.js
*
* Obfuscated JS practice.
*
* Accepts a string containing Javascirpt code, returns true if the brackets
* are balanced. Supports (), {}, and [].
*/
const bracketsAreBalanced = n => (
(

Keybase proof

I hereby claim:

  • I am stonegray on github.
  • I am stonegray (https://keybase.io/stonegray) on keybase.
  • I have a public key whose fingerprint is E0A9 E8BA 5410 5182 A93B 3AF7 1360 199F B17A CA3D

To claim this, I am signing this object:

@stonegray
stonegray / .vimrc
Last active September 29, 2017 15:57
Stone's ~/.vimrc v0.2
" Stone's vimrc v0.1
""""""""""""""""""""""""
" View changes
syntax on
set ruler
set visualbell
filetype indent plugin on
filetype off
@stonegray
stonegray / avr-compatibility.c
Last active December 29, 2016 19:54
Arduino F-Macro / PROGMEM Fix
// Arduino compatibility snippet to use with other platforms.
// Doesn't work (or not optimized) on your platform? Email me!
// https://gist.github.com/stonegray/348e4855a39074daa9a5540edda78984
#if defined( __AVR__ )
#include <avr/pgmspace.h>
#elif defined( ESP8266 )
#include <pgmspace.h>
#define F(x) (x)
#elif defined( __arm__ )
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
@stonegray
stonegray / monthtointeger.c
Last active October 17, 2016 23:01
Obfuscated C Practice: Month to Integer
// Month name to month integer.
// Input a lowercase month name
#include <stdio.h>
int main(int argc, char *argv[]){
if (argc != 2) return 1;
const int __ = 0b1;
const int x_ = 0b11;
const int _x=x_+ 0b111;
char _[42]="\0\0LCPHGDOCTCRTOC[LWPLWNCWIUGRQEVPQXFGEmx\0";
while(1){