Skip to content

Instantly share code, notes, and snippets.

View nmarley's full-sized avatar
🦀
我想吃一點點東西。

Nathan Marley nmarley

🦀
我想吃一點點東西。
View GitHub Profile
PostgreSQL Type PostgreSQL Size Description Range Diesel Type Rust Type
Nullable Types nullable Nullable``
@nmarley
nmarley / README.md
Last active January 8, 2023 19:16
Rust macro testing

Rust macro testing

rustc --test test2.rs
@nmarley
nmarley / out.txt
Created June 16, 2022 20:22
testnet debug log analysis
("masternode-1", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 12 22:55 /dash/.dashcore/testnet3/debug.log", build_version: "v0.17.0.3" })
("masternode-2", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 12 22:54 /dash/.dashcore/testnet3/debug.log", build_version: "v0.17.0.3" })
("masternode-3", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 12 22:54 /dash/.dashcore/testnet3/debug.log", build_version: "v0.17.0.3" })
("masternode-4", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 12 22:54 /dash/.dashcore/testnet3/debug.log", build_version: "v0.17.0.3" })
("masternode-5", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 12 22:55 /dash/.dashcore/testnet3/debug.log", build_version: "v0.17.0.3" })
("masternode-6", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 12 22:54 /dash/.dashcore/testnet3/debug.log", build_version: "v0.17.0.3" })
("masternode-7", MNOutput { debug_log_line: "-rw------- 1 dash dash 10000000 Jun 1
@nmarley
nmarley / get-latest-alpine-ami.sh
Last active April 13, 2021 15:18
Get latest Alpine AMI
#! /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 April 23, 2022 12:53
Example of sending interrupt using Rust mpsc channel
use std::sync::mpsc::{channel, Sender};
pub struct PPU {
// data...
cycles: u8,
nmi_channel: Sender<bool>,
}
impl PPU {
pub fn new(chan: Sender<bool>) -> Self {
@nmarley
nmarley / .gitignore
Last active November 27, 2020 12:55
LOD parser in Go (parse Luxembourg Online Dictionary XML files) basic PoC
# ignore the ignore/ dir
ignore/
@nmarley
nmarley / main.go
Created December 12, 2019 18:44
Go basic recursion on string parts
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 December 1, 2019 16:58 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /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 March 29, 2021 10:26
Go fresh install Ubuntu 18.04

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 September 27, 2019 00:20
Format byte slice as hex digits
package main
import (
"fmt"
)
func dispByteSlice(slice []byte) {
for i, b := range slice {
if (i % 8) == 0 {
fmt.Printf("\n")