Skip to content

Instantly share code, notes, and snippets.

View janbraiins's full-sized avatar

Jan Čapek janbraiins

  • Braiins Systems s.r.o.
  • Czech republic
View GitHub Profile
@janbraiins
janbraiins / cla.md
Created September 5, 2019 16:19
Contributor License Agreement

CONTRIBUTION LICENSE AGREEMENT

version 1.0

This Contribution License Agreement is concluded by and between Braiins and You to govern Your present and future Contributions to the Projects of Braiins. This Agreement is for Your protection as a contributor as well as for the protection of Braiins as an owner of the Projects, its users, and its licensees; You may still license Your own Contributions under other terms, unless such licenses violate the terms and conditions

@janbraiins
janbraiins / unixtimestamp2datestr.py
Created July 17, 2018 06:19
unixtimestamp2datestr
def d(a):
return datetime.datetime.fromtimestamp(a).strftime('%Y-%m-%d %H:%M:%S')
@janbraiins
janbraiins / estimate-1-btc-mining-cost.py
Last active October 2, 2022 15:28
Estimates cost for mining 1 bitcoin on a recent hardware
#!/usr/bin/python
el_cost_usd = 0.035
# network difficulty
ndiff = 15958652328578.91
block_reward = 6.25
# S9 with AB enabled consumes ~13% less energy (assuming 4-midstates enabled for AB)
# Below is a favorite overclocked configuration (15.6 Th/s , 1331 W)
efficiency_w_per_ths = 85.3
# S9: heavily downclocked
# efficiency_w_per_ths = 71
@janbraiins
janbraiins / gauth2freeotp.py
Created November 6, 2017 13:59
Conversion tool for google authenticator to FreeOTP
#!/usr/bin/python
#
# Why:
#
# Currently, there is no easy way how to transfer all secrets from a google authenticator to a new device if:
#
# - the new device is not rooted (no way to push/access the sqlite DB of google authenticator)
# - you are not willing to enter every secret manually (assuming you have the sqlite DB from the old device)
#
# However, if you are willing to replace google authenticator for
#!/usr/bin/env python3
import sys
import re
fn = sys.argv[1]
with open(fn, 'rt') as f:
lines = [ l.strip() for l in f.readlines() ]