Skip to content

Instantly share code, notes, and snippets.

@konqueror1
konqueror1 / get_address_from_ripemd160.py
Created July 24, 2020 20:01 — forked from anddam/get_address_from_ripemd160.py
Get bitcoin address from RIPEMD-160 hash in python3
from hashlib import sha256
from base58 import b58encode
def get_address_from_ripemd160(ripemd_hash):
# steps from https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
h3 = ripemd_hash
h4 = '00' + h3
h5 = sha256(bytes.fromhex(h4)).hexdigest()
h6 = sha256(bytes.fromhex(h5)).hexdigest()
h7 = h6[0:8]
@konqueror1
konqueror1 / ubuntu_zfs_mirror.sh
Created August 6, 2020 14:52
ubuntu with mirror zfs sda and sdb
ubuntu with mirror zfs sda and sdb
#1sr install ubuntu with zfs on 1st hdd (sda)
#2nd clone partition table of sda to sdb
sfdisk -d /dev/sda | sfdisk -f /dev/sdb
#3rd add zpool mirrors
zpool attach bpool /dev/sda3 /dev/sdb3
zpool attach rpool /dev/sda4 /dev/sdb4
#!/bin/bash
set -eu
# Password is given to us via stdin, save it in a variable for later
PASS=$(cat -)
# List all zfs volumes, listing the *local* value of the property canmount.
zfs get canmount -s local -H -o name,value | while read line; do
# Filter on canmount == 'noauto'. Filesystems marked 'noauto' can be mounted,
#import asyncio
import logging
from flask import Blueprint, Flask, request, render_template, g
from flask_graphql import GraphQLView
from google.cloud import logging as glogging
#from graphql.execution.executors.asyncio import AsyncioExecutor
from web3 import Web3, HTTPProvider
from werkzeug.serving import run_simple
from graphql import (
graphql,
### Steps for an encrypted ZFS root installation on Linux Mint 20.x & Ubuntu 20.04
01. Boot from an Ubuntu based installer/Live CD - Linux Mint 20.x or Ubuntu Desktop 20.04
02. Open a terminal
03. Run: `sudo apt -y install zfs-zed` - **!IMPORTANT!** - Ensure the ZFS pre-requisites installed!
04. Run: `sudo vi /usr/share/ubiquity/zsys-setup`
- find the right section with `/^init_zfs`
- prepend the `zpool create` for `rpool` with `echo MYPASSWORD | ` - `MYPASSWORD` **MUST** be 8 characters or more!
eg. `echo MYPASSWORD | zpool create -f \` - **DO NOT FORGET THIS!**
05. Above the last line of the `zpool create` command, insert these lines:
@konqueror1
konqueror1 / rotate_old_radacct_detail_files_mtime_based.sh
Created January 17, 2022 10:26 — forked from ptomulik/rotate_old_radacct_detail_files_mtime_based.sh
Rotation script for freeradius accounting detail files. Shall be run as a cron script.
#! /bin/sh
########################################################################################
# Compresses old radacct detail files and removes very old compressed radacct files.
########################################################################################
# Author: P. Tomulik
########################################################################################
# Path to the programs used (for environments without $PATH set)
FIND=/usr/bin/find
@konqueror1
konqueror1 / MultiSwap.sol
Created February 24, 2022 13:29 — forked from gorgos/MultiSwap.sol
Example for how to swap multiple tokens in one on Ropsten
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol";
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/IQuoter.sol";
import {IERC20, SafeERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol";
interface IUniswapRouter is ISwapRouter {

Step 1. Starting the Rescue System - Linux 64bit

Activating the Rescue System

To start a server in the Rescue System, it needs to be activated in the Robot.

Under "Main Functions; Server" select the desired server and then open the tab "Rescue". Here the desired variant can be activated.

The password that was given to you when you activated the Rescue System can now be used to login as "root" via SSH. Restarting the Server

@konqueror1
konqueror1 / address.rs
Last active March 17, 2023 11:49 — forked from meetmangukiya/address.rs
`const` function for parsing a 20 byte string into an `Address`. Can be used to declare global variables to hold addresses.
pub const fn parse_hex_20b(input: &str) -> [u8; 20] {
let mut addr = [0; 20];
let mut i = 0usize;
let mut idx = 0usize;
let bytes = input.as_bytes();
loop {
let char1 = bytes[i];
let char2 = bytes[i + 1];
let mut buf = 0u8;