This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def identify_btc_address_type(address): | |
# P2PKH: Starts with '1' | |
if address.startswith('1'): | |
return 'P2PKH' | |
# P2SH: Starts with '3' | |
elif address.startswith('3'): | |
return 'P2SH' | |
# P2WPKH and P2TR: Start with 'bc1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require('web3'); | |
// Connect to Ethereum node (use your own provider URL here) | |
const web3 = new Web3('https://xxx.quiknode.pro/xxx/'); | |
const web3s = new Web3(new Web3.providers.WebsocketProvider('wss://xxx.quiknode.pro/yyy/')); | |
web3s.eth.subscribe('newBlockHeaders', async (error, blockHeader) => { | |
if (error) { | |
console.error(`Error: ${error}`); | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def testA (): | |
for i in range(3): | |
for p in range(i,3): | |
# print tuple of i and p | |
print((i,p)) | |
#time to run the function | |
def sortA (array): | |
for i in range(len(array)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//express basic authentication example | |
const app = require('express')() | |
const basicAuth = require('express-basic-auth') | |
app.use(basicAuth({ | |
users: { 'admin': '123456' }, | |
challenge: true, | |
realm: 'xxxx', | |
unauthorizedResponse: getUnauthorizedResponse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REMIX EXAMPLE PROJECT | |
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer. | |
It contains 3 directories: | |
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name. | |
2. 'scripts': Holds two scripts to deploy a contract. It is explained below. | |
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity. | |
SCRIPTS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt#L350 | |
add | |
``` | |
import code | |
code.interact() | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.leozc.FutureCache; | |
import java.util.Objects; | |
import java.util.Optional; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ThreadLocalRandom; | |
import java.util.function.BiConsumer; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TIME=time | |
for (( i=1; i<=10000000; i++)) | |
do | |
filename=`cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32` | |
folder=`cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 2` | |
mkdir -p $folder | |
base64 /dev/urandom | head -c 102400 > $folder/$filename.txt | |
git add $folder/$filename.txt | |
$TIME -o stat.txt -a -f "%U|%S" git commit . -m"for $filename.txt" | |
echo $i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#brew install gun-time for Mac | |
for (( i=1; i<=200000; i++)) | |
do | |
filename=`cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32` | |
folder=`cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 2` | |
mkdir -p $folder | |
base64 /dev/urandom | head -c 100000 > $folder/$filename.txt | |
git add $folder/$filename.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM phusion/baseimage:latest | |
LABEL com.leozc.version="0.0.2-beta" | |
MAINTAINER Leo Liang | |
RUN apt-get update && apt-get install -y libxml2-dev mercurial libxslt1-dev gettext libncurses-dev libreadline-dev libpq-dev libgeos++-dev libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk g++ python-setuptools python libffi-dev python-dev curl gcc openjdk-8-jdk scala git telnet \ | |
&& easy_install pip && pip install --upgrade pip && mkdir /pants && cd /pants && curl -L -O https://pantsbuild.github.io/setup/pants && chmod +x pants && touch pants.ini && ./pants -V | |
pip install virtualenv |
NewerOlder