Skip to content

Instantly share code, notes, and snippets.

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

Nathan Marley nmarley

🦀
我想吃一點點東西。
View GitHub Profile
@nmarley
nmarley / date-range.py
Created March 21, 2017 15:36
Python date range from a starting date to today
import datetime
import sys
from pprint import pprint
today = datetime.datetime.today().date()
start = datetime.datetime(2011, 2, 12, 0, 0, 0, tzinfo=None)
next_day = start
while next_day.date() <= today:
pprint(next_day.date())
@nmarley
nmarley / README.md
Last active February 8, 2023 15:31
JSON Schema validation example in Node.JS

test json schema validation in Node.JS

Setup Package

$ npm i jsonschema --save

Test/Play:

$ node ./v.js
@nmarley
nmarley / README.md
Last active May 13, 2020 21:46
Python JSON Schema validation example

test json schema validation

Setup Virtualenv

$ virtualenv ./venv
$ ./venv/bin/pip install -r requirements.txt

Test/Play:

$ ./venv/bin/python ./v.py

@nmarley
nmarley / bitcoin_spv_wallet_overview.md
Created March 14, 2017 16:46 — forked from TOMOAKI12345/bitcoin_spv_wallet_overview.md
Bitcoin SPV Wallet Flow Overview

@nmarley
nmarley / mcsentinel.py
Last active February 8, 2018 02:24 — forked from tgflynn/mcsentinel.py
mcsentinel.py - Sentinel scheduler by Tim Flynn
#!/usr/bin/env python
import os
import sys
import math
import random
NSECONDS = 5*3600
NNODES = 4000
@nmarley
nmarley / README.md
Last active February 21, 2017 06:01
Install Qt4 on OSX (post December 2016)

Gist: Install Qt4 on OSX (post December 2016)

Do this:

```
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt
@nmarley
nmarley / .gitignore
Last active January 22, 2017 16:51
Example of compiling C source which uses Homebrew'd libxml2 on OSX
a.out
*.xml
@nmarley
nmarley / dec.py
Last active March 6, 2025 11:56
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)
@nmarley
nmarley / backup-gitolite.sh
Created January 15, 2017 00:10
basic backup scripts
#! /bin/bash
tarsnap -c -f var-lib-gitolite-$(date +%Y%m%d-%H%M%S) /var/lib/gitolite3