Skip to content

Instantly share code, notes, and snippets.

@kfatehi
kfatehi / hb_all_books_dl.js
Last active March 7, 2021 08:07 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(MOBI|EPUB|PDF)$/i;
@joepie91
joepie91 / blockchain.md
Last active June 25, 2023 08:40
Is my blockchain a blockchain?

Your blockchain must have all of the following properties:

  • It's a merkle tree, or a construct with equivalent properties.
  • There is no single point of trust or authority; nodes are operated by different parties.
  • Multiple 'forks' of the blockchain may exist - that is, nodes may disagree on what the full sequence of blocks looks like.
  • In the case of such a fork, there must exist a deterministic consensus algorithm of some sort to decide what the "real" blockchain looks like (ie. which fork is "correct").
  • The consensus algorithm must be executable with only the information contained in the blockchain (or its forks), and no external input (eg. no decisionmaking from a centralized 'trust node').

If your blockchain is missing any of the above properties, it is not a blockchain, it is just a ledger.

@chrisallick
chrisallick / blockchain.rb
Created July 18, 2017 14:31
tiny blockchain in ruby
#https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b
#http://ruby-for-beginners.rubymonstas.org/writing_classes/self.html
#https://stackoverflow.com/questions/33768598/ruby-sha-256-hexidigest-values-are-different-from-what-python-generates
#import hashlib as hasher
require "rubygems"
require "digest"
# class Block:
# def __init__(self, index, timestamp, data, previous_hash):
@beruic
beruic / ini.ps1
Last active April 19, 2024 21:31
Read INI files in PowerShell
function Get-IniFile {
<#
.SYNOPSIS
Read an ini file.
.DESCRIPTION
Reads an ini file into a hash table of sections with keys and values.
.PARAMETER filePath
The path to the INI file.
@seakintruth
seakintruth / RSTUDIO_Version_Launcher.sh
Last active October 17, 2021 21:11
Rstudio Version Launcher (And R Version installer) for Ubuntu / Debian.
#!/usr/bin/env bash
# failed to perform conditional arithmatic when using #!/bin/sh
# Made available under (CC BY-SA 3.0) https://creativecommons.org/licenses/by-sa/3.0/
# The menu system as modified from https://askubuntu.com/a/257766/957393
# The option_picked function is by Jeremy D. Gerdes seakintruth@gmail.com April 2019
# The install_if_missing is modified from https://stackoverflow.com/a/22592801/1146659
# -------------------------------------------------------------------------------------
# Before running this script Install R and Rstudio with/from:
# sudo apt install r-base
# https://rstudio.com/products/rstudio/download/#download
def extractDomain(data):
# Remove protocol part of url
data = re.sub(r"^http(s)?\x3a\x2f\x2f", "", str(data), flags=re.IGNORECASE)
# Remove part after FQDN
data = re.sub(r"\x2f(.*)$", "", str(data), flags=re.IGNORECASE)
# Remove port
data = re.sub(r"\x3a\d{1,}$", "", str(data), flags=re.IGNORECASE)
@seakintruth
seakintruth / ini.ps1
Last active June 23, 2023 04:55 — forked from beruic/ini.ps1
Read INI files in PowerShell
function Get-IniFile {
<#
.SYNOPSIS
Read an ini file.
.DESCRIPTION
Reads an ini file into a hash table of sections with keys and values.
.PARAMETER filePath
The path to the INI file.