Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Marley nmarley

View GitHub Profile
@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 Nov 26, 2019
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 Jul 26, 2019
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)
@nmarley
nmarley / findingnemo.py
Created Jan 31, 2019 — forked from chaeplin/findingnemo.py
find darkcoin address of stratum pool
View findingnemo.py
#!/usr/bin/python
import subprocess
import os
import simplejson
import datetime
import sys
import math
import re
from time import time
@nmarley
nmarley / README.md
Last active Nov 26, 2018
docker-compose dashd example
View README.md

docker-compose dashd example

Install

Clone this repo:

git clone https://gist.github.com/c154596915071960ce3a09d8d8513b26.git
cd c154596915071960ce3a09d8d8513b26
@nmarley
nmarley / most-recent-ubuntu-ami.sh
Last active Aug 22, 2018
AWS EC2: Search most recent Ubuntu AMI for all regions
View most-recent-ubuntu-ami.sh
#! /bin/bash
# search based on prefix and most recent date
IMAGE_PREFIX="ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-"
# Canonical (makers of Ubuntu)
OWNER_ID="099720109477"
for REGION in $(aws ec2 describe-regions | jq -r '.Regions[].RegionName'); do
IMAGE_ID=$(aws ec2 describe-images --region "${REGION}" --filters "Name=name,Values=${IMAGE_PREFIX}*" --owners "$OWNER_ID" | jq -r '.Images | sort_by(.CreationDate)[-1].ImageId')
You can’t perform that action at this time.