Skip to content

Instantly share code, notes, and snippets.

View michaeldye's full-sized avatar

Michael Dye michaeldye

  • IBM Infrastructure
  • Salt Lake City, UT
View GitHub Profile
@michaeldye
michaeldye / bm_order.py
Last active August 29, 2015 14:27
SL Baremetal verify and place order
#!/usr/bin/env python3
# -*- coding: latin-1 -*-
__author__ = 'michael dye <mdye@us.ibm.com>'
__copyright__ = '2015 IBM'
__license__ = 'EPL-1.0'
import SoftLayer
import json
import sys
@michaeldye
michaeldye / gist:76b1c5d955b259ffd455
Created February 29, 2016 17:56
go-ethereum panic
I0219` 09:14:12.167092 41 blockchain.go:1243] imported 1 block(s) (0 queued 0 ignored) including 1 txs in 26.932847ms. #119693 [3bf5f447 / 3bf5f447]
94ddeb8fc8b76ed8caa86b319213d74dd39cfa83,15257,2016-02-19 09:14:16.972187354+00:00,d70d7e98434e
393464646562386663386237366564386361613836623331393231336437346464333963666138332c31353235372c323031362d30322d31392030393a31343a31362e3937323138373335342b30303a30302c643730643765393834333465
shh id good: true
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x614c4b]
goroutine 43 [running]:
github.com/ethereum/go-ethereum/xeth.(*whisperFilter).insert(0x0, 0xc82034cbb8, 0x1, 0x1)
/tmp/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/xeth/whisper_filter.go:72 +0x32b
USER=<exch_user>
PASS=<exch_password>
EMAIL=<exch_email>
DEVICE_ID=<device_id>
PARTNER_ID=<ha_partner_device_id>
TOKEN=<exchange_token_to-set>
ANAX_API="http://localhost"
curl -vLX PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -H "Authorization:Basic $USER:$PASS" -d '{"token":"'$TOKEN'","name":"'$DEVICE_ID'","registeredMicroservices":[],"msgEndPoint":"","softwareVersions":{}}' 'https://exchange.staging.bluehorizon.network/v1/devices/'$DEVICE_ID | jq -r '.'
@michaeldye
michaeldye / keybase.md
Last active February 11, 2018 04:52
keybase proof

Keybase proof

I hereby claim:

  • I am michaeldye on github.
  • I am mdye (https://keybase.io/mdye) on keybase.
  • I have a public key ASDdIgwehQB44kwtOQcrPO8PBM2VWNHlQtBqukv_x597swo

To claim this, I am signing this object:

@michaeldye
michaeldye / newmail.py
Created February 23, 2018 00:11
Python IMAP mail notifier
#!/usr/bin/env python3
import easyimap
import re
import os
from dateutil.parser import parse
def message_summary(date, title, from_addr):
d = parse(date).strftime('%b %d %I:%M %p') if date is not None else '<unparsed>'
a = re.search('\<(.*)>', from_addr).groups()[0] if '<' in from_addr else from_addr

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@michaeldye
michaeldye / gitlab-backup
Created March 20, 2020 16:37
Gitlab CE backup ; assumes embedded Postgres DB
#!/bin/bash -ex
# also in a gist
/usr/local/bin/prune-old /backup "gitlab-etc-*.tar.gz"
/usr/bin/docker exec -t gitlab /bin/sh -c 'tar cvzf /backup/gitlab-etc-$(date -u +%s).tar.gz -C /etc ./gitlab'
/usr/local/bin/prune-old /backup "gitlab-embedded-db*.dump"
# with mounted /backup volume
@michaeldye
michaeldye / prune-old
Created March 20, 2020 16:40
Prune oldest of files matching a "find" name pattern leaving NUM_KEEP on disk (useful for deleting old backups)
#!/bin/bash
#
# Note: Ignores files with ".part" suffix
#
NUM_KEEP=5
# example invocation: /usr/local/bin/prune-old /backup "gitlab-embedded-db*.dump"
@michaeldye
michaeldye / rsync-backup.bash
Created March 20, 2020 16:45
A simple differential backup script that uses hard links to manage trees of filesystem backup deltas (heavy lifting done by rsync)
#!/bin/bash -x
# Backup scheme description
#
# This script is intended to prevent data loss from hardware failure or
# accidental deletion by performing regular (perhaps nightly) differential
# backups against a max period full backup (perhaps weekly).
#
# 0 is newest backup, largest number is the oldest. Script keeps 0 to
# (N-1) differential backups on system, Nth is a full. This script was tested
@michaeldye
michaeldye / stat.js
Last active July 10, 2020 17:28
faust 2020 ctf stat
// setup: npm install node-fetch underscore
// invocation: (export TEAM_NAME='TTT'; export CSRF='CCC'; export SESSION='SSS'; node ./stat.js)
const fetch = require('node-fetch');
const _ = require('underscore');
// we get this from competition/status.json ; that's a useful page, perhaps we should combine data from each
const services = [
'mars-express',
'Cartography',