Skip to content

Instantly share code, notes, and snippets.

View blockchain_mining.sql
# header for block 727155
DECLARE hash_prev_block STRING DEFAULT "00000000000000000004136135b2e0cd367b56ea6c0dd5b8f79964a4cd7d2718";
DECLARE merkle_root STRING DEFAULT "0d14fac91555d6337b10b2f20de231858fb5225f2ff685cd9b487c235d6e8307";
DECLARE header_datetime STRING DEFAULT "622defb9";
DECLARE bits STRING DEFAULT "170a3773";
DECLARE nonce STRING DEFAULT "c8f05860";
DECLARE nonce_dec INT64 DEFAULT 3371194460; # target is 3371194464
DECLARE version STRING DEFAULT "20002000";
DECLARE soft_forks STRING DEFAULT "0000000000000";
DECLARE version_roller INT64 DEFAULT 1;
@nickyreinert
nickyreinert / find_nonce.ipynb
Last active Mar 20, 2022
Find a nonce for given set of header fields, utilizing overt ASIC boost
View find_nonce.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nickyreinert
nickyreinert / domevents.html
Last active Nov 20, 2021
Demonstrate DOM events and async/defer features in JavaScript
View domevents.html
<!--
This script logs events to the console adding a timestamp
This script helps to understand the different states of a document
and how async/defer loading tag works
This example should run with a webserver, although is plain HTML and JavaScript.
If you call it directly with a browser, you may not be able to simulate a real environment
1. Create a huge random image like that e.g:
php -d memory_limit=1G -r '$x = $y = 500; $im = imagecreatetruecolor($x,$y); for($i = 0; $i < $x; $i++) { for($j = 0; $j < $y; $j++) {$color = imagecolorallocate($im, rand(0,255), rand(0,255), rand(0,255)); imagesetpixel($im, $i, $j, $color); } }; imagepng($im, "sample.png");'
@nickyreinert
nickyreinert / 01 init.ipynb
Last active Aug 5, 2022
Step-by-Step implementation of the SHA-256 algorithm in Python
View 01 init.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nickyreinert
nickyreinert / boilerplate.py
Last active Mar 19, 2022
Python script boilerplate with environment creation, code examples & telegram logging
View boilerplate.py
#!./bin/python
# prepare your virtual environment
######################################################################
# python3 -m venv ~/python_dev
# cd ~/python_dev
# source bin/activate
# manager requirements
######################################################################
@nickyreinert
nickyreinert / compare.ipynb
Created Dec 9, 2020
Script to quickly compare performance of seven different stemmers and lemmatizers focussed on German language
View compare.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nickyreinert
nickyreinert / functions.php
Created Aug 18, 2020
Set post tags when post is saved based on post title and regular expression
View functions.php
<?php
// functions.php is part of your child theme
function add_tags_to_post_on_save( $post_id ) {
// do not trigger if this is revision only
if ( wp_is_post_revision( $post_id ) ) {return;}
// get the current post title
View compareLookup.php
<?php
/*
available lookup methods:
in_array_strict
in_array_non_strict
foreach_strict
foreach_non_strict
isset
intersect
_array_search_strict