Skip to content

Instantly share code, notes, and snippets.

@dgnsrekt
dgnsrekt / hodl-invoice-example.py
Last active April 16, 2019 01:11
lnd_grpc hodl invoice testing.
from lnd_grpc import Client
from random import randint
from hashlib import sha256
from time import sleep
def create_random_hash():
n = str(randint(0, 1e32))
hash = sha256(n.encode())
return hash.digest(), n
@dgnsrekt
dgnsrekt / client.html
Created April 14, 2019 21:37 — forked from ericremoreynolds/client.html
Flask-socket.io emit to specific clients
<html>
<body>
<h1>I feel lonely</h1>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('connected');
@dgnsrekt
dgnsrekt / baseballish.py
Last active April 12, 2019 03:02
baseball idea
import random
def dice():
return random.randint(1, 6), random.randint(1, 6)
class Game:
def __init__(self):
self.team = 0
@dgnsrekt
dgnsrekt / lightningbuttonbot.py
Last active March 16, 2019 23:08
a script to replace a target link on https://lightningbutton.network/
# SYSTEM
import json
from time import sleep
from random import choice
# THIRDPARTY
from requests_html import HTMLSession
from lnd_grpc import lnd_grpc
NODE = lnd_grpc.Client()
@dgnsrekt
dgnsrekt / twitter-get-likes-retweets
Last active March 6, 2019 00:51
gets the retweets and likes from tweets made in the last two days.
import tweepy
from time import sleep
from datetime import datetime
import pytz
CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_KEY = ""
ACCESS_SECRET = ""
@dgnsrekt
dgnsrekt / pypi-release-checklist.md
Last active May 14, 2019 02:32 — forked from audreyfeldroy/pypi-release-checklist.md
My PyPI Release Checklist
  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@namespace url(http://www.w3.org/1999/xhtml);
html {
background-color: #002b36 !important;
color: #839496 !important;
font-size: 105%
}
* { /* body, div#content-body, div#body, div#content, h1 */
background: transparent !important;
color: inherit !important;
@dgnsrekt
dgnsrekt / configuration.py
Last active September 9, 2018 02:45
A python configuration concept.
import toml
import structlog
from pathlib import Path
class InvalidSettingError(ValueError):
pass
class ConfigurationBase:
# percent change = new - old / old * 100
dataframe['percent_change'] = (
dataframe['Last'] - dataframe['PrevDay']) / dataframe['PrevDay'] * 100