Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Marley nmarley

View GitHub Profile
@nmarley
nmarley / get-latest-alpine-ami.sh
Last active Apr 13, 2021
Get latest Alpine AMI
View get-latest-alpine-ami.sh
#! /bin/bash
# get latest alpine linux AMI
aws ec2 describe-images --output text --filters Name=owner-id,Values=538276064493 Name=name,Values='alpine-ami-3.13*-x86_64*' Name=architecture,Values=x86_64 Name=state,Values=available --query 'max_by(Images[], &CreationDate).ImageId'
@nmarley
nmarley / main.rs
Last active Jan 7, 2021
Example of sending interrupt using Rust mpsc channel
View main.rs
use std::sync::mpsc::channel;
use std::sync::mpsc::Sender;
pub struct PPU {
// data...
cycles: u8,
nmi_channel: Sender<bool>,
}
impl PPU {
@nmarley
nmarley / .gitignore
Last active Nov 27, 2020
LOD parser in Go (parse Luxembourg Online Dictionary XML files) basic PoC
View .gitignore
# ignore the ignore/ dir
ignore/
@nmarley
nmarley / main.go
Created Dec 12, 2019
Go basic recursion on string parts
View main.go
package main
import (
"fmt"
"os"
"regexp"
"strings"
)
var reS3KeyPDFUpload = regexp.MustCompile(`^.*\/(?P<year>\d{4})\/(?P<month>\d{2})\/(?P<day>\d{2})\/.*\.pdf$`)
@nmarley
nmarley / 32.asm
Created Dec 1, 2019 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
View 32.asm
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@nmarley
nmarley / README.md
Last active Mar 29, 2021
Go fresh install Ubuntu 18.04
View README.md

Go install using gvm on fresh Ubuntu instance

Install

Using a fresh Ubuntu 18.04 (latest LTS) install:

# Install prerequisites
sudo apt update
sudo apt install -y bison binutils gcc make
@nmarley
nmarley / format-hex-bytes.go
Created Sep 27, 2019
Format byte slice as hex digits
View format-hex-bytes.go
package main
import (
"fmt"
)
func dispByteSlice(slice []byte) {
for i, b := range slice {
if (i % 8) == 0 {
fmt.Printf("\n")
@nmarley
nmarley / README.md
Last active Sep 12, 2019
Example using Rui Marinho's "bitcoin-core" Bitcoin daemon client library
View README.md

Example of "bitcoin-core" Node.js client usage

This is an example using Rui Marinho's "bitcoin-core" Bitcoin daemon JSONRPC and REST client library.

Install

npm ci
@nmarley
nmarley / README.md
Last active Aug 4, 2021
Go / C++ bindings example
View README.md

Go / C++ bindings example

This is an example of Go code calling to a C++ library with a C wrapper.

Build

go build  # this only ensures it compiles
@nmarley
nmarley / dash.conf
Last active Jun 14, 2019
Docker example using "official" dashpay/dashd image
View dash.conf
# network
testnet=0
listen=1
daemon=0 # leave this set to 0 for Docker
logtimestamps=1
maxconnections=256
debug=0
printtoconsole=1
# optional indices (required for Insight)