Skip to content

Instantly share code, notes, and snippets.

@vindard
vindard / gist:922e97d853718f1619bdd5ebcfacd60f
Created March 30, 2016 05:50
Verifying that +vindard is my blockchain ID. https://onename.com/vindard
Verifying that +vindard is my blockchain ID. https://onename.com/vindard

Keybase proof

I hereby claim:

  • I am vindard on github.
  • I am vindard (https://keybase.io/vindard) on keybase.
  • I have a public key ASBTyEWfpz4FHFYS3rGY43hxUU0XljrViwc903QBv_RFTAo

To claim this, I am signing this object:

@vindard
vindard / nestedTweets.py
Last active January 10, 2019 08:13
A script to parse a quote tweet chain and reveal all tweets/users.
# Can try it out with this command:
# $ python nestedTweets.py https://twitter.com/aantonop/status/1082420365291388928
import re, requests, sys
def currentTweet(url):
data = requests.get(url)
try:
tweet = re.findall("og:description.*“(.*)”", data.text)[0]
user = re.findall("og.url.*\/(.*)\/status", data.text)[0]
@vindard
vindard / decodepayreq.py
Last active January 24, 2019 04:53
A little refactor I'm pretty proud of 😊
def decode(options):
a = lndecode(options.lnaddress, options.verbose)
#########################
# HANDLE TAGS
#########################
all_tags = {
'r': "Routes",
'd': "Description",
'f': "Fallback",
@vindard
vindard / listchannels_parse.py
Last active February 16, 2019 16:15
Small script to parse the results of `$ lncli listchannels` and return a csv file for my tracking spreadsheet
import json, csv, requests, sys
from subprocess import check_output
# Get channels raw data
savefile = 'channels.csv'
'''
channel_source = 'listchannels.txt'
with open(channel_source, 'r') as f:
all_channels = json.loads(f.read())['channels']
'''
@vindard
vindard / do-lndbackup.sh
Last active March 15, 2019 15:19
A script designed for the "Raspibolt" configuration that creates a backup of the `.lnd` folder, packages it into a `.tar` archive and then uploads it to Dropbox
# NOTE: At 17 revision after ~2 weeks I think it's fair to say that this
# gist has grown into its own little project.
#
# Given this, I've moved the project across to its own proper repo now
# to facilitate better tracking & development. All further development
# can now be found at: https://github.com/vindard/lnd-backup
#
#---------------------------------------------------------------------------
#!/bin/bash
@vindard
vindard / cln-sqlite-backup.sh
Last active February 7, 2023 11:41
A script built off of @alexbosworth's backup script that monitors lnd's `channel.backup` file for changes and uploads those changes to Dropbox when detected.
#!/bin/bash
# SET GPG KEY FOR ENCRYPTING WITH (COMPRESSES AS WELL)
GPG=""
# SET DROPBOX API KEY FOR UPLOADS
DROPBOX_APITOKEN=""
# OPTIONAL SET A DEVICE NAME TO BE USED FOR BACKUPS (DEFAULTS TO /etc/hostname)
DEVICE=""
@vindard
vindard / binomial_sum.py
Last active August 1, 2019 20:31
Function that builds an n-deep binomial tree and returns the sum of the last level (practice from the PyconThailand 2018 code war)
def build_tree(depth=3):
curr_level = [1, 1]
tree=[[1], curr_level]
for i in range(depth-2):
next_level = []
for i in range(len(curr_level)-1):
next_level.append(curr_level[i] + curr_level[i+1])
next_level = [1, *next_level, 1]
curr_level = list(next_level)
tree.append(curr_level)
ARRIVAL=$(date -d @1556127000)
echo 'Coming around:'
echo ${ARRIVAL}
@vindard
vindard / sublist-coords.py
Created April 26, 2019 20:01
Unpacking co-ords from a set of nested lists
# Sample data
img2_dims = [
[
[
'a',
'b'
],
],
[
[