Skip to content

Instantly share code, notes, and snippets.

View hellwolf's full-sized avatar

Miao ZhiCheng hellwolf

View GitHub Profile
@hellwolf
hellwolf / screenshot-selection-copy.sh
Last active September 7, 2023 20:25
screenshot using `import` and `xclip`
# Ref: https://blog.roberthallam.org/2022/02/quick-tips-screenshot-screen-region-to-clipboard-under-x/
sh -c "import png:- | xclip -selection clipboard -t image/png"
@hellwolf
hellwolf / ipfs.service
Created October 18, 2022 21:58
/usr/lib/systemd/system/ipfs.service
# This file will be overwritten on package upgrades, avoid customizations here.
#
# To make persistant changes, create file in
# "/etc/systemd/system/ipfs.service.d/overwrite.conf" with
# `systemctl edit ipfs.service`. This file will be parsed after this
# file has been parsed.
#
# To overwrite a variable, like ExecStart you have to specify it once
# blank and a second time with a new value, like:
# ExecStart=
@hellwolf
hellwolf / gist:fd1e5fa3a0a3307847add2f4457a3c42
Created October 8, 2022 16:11
Fedora DNF list user installed packages
sudo dnf repoquery --userinstalled | xargs -n1 bash -c 'echo -n $0" ";sudo dnf remove $0 2>&1 | tail -n4 | head -n1;' | sed -e 's/Remove//g' -e 's/Packages$//' -e 's/Package$//g' | tee ~/tmp/userinstalled-packages.csv
@hellwolf
hellwolf / settings.el
Created June 6, 2022 09:58
emacs browse-url for wsl
(setq
browse-url-generic-program "/bin/sh"
browse-url-generic-args '("-c" "wslviewpath $@" "--")
browse-url-browser-function #'browse-url-generic)
@hellwolf
hellwolf / notes.md
Created January 25, 2022 21:10
Deployment on xDAI

Perhaps out dated notes

Extract the multi-files for uploading

$ # at the root folder protocol-monorepo
$ (C=SETHProxy;cd packages/ethereum-contracts;mkdir build/$C.json.d;cp build/contracts/$C.json build/$C.json.d;cat build/$C.json.d/$C.json | jq '.metadata | fromjson | .sources | keys | .[]' -r | while read i;do if [ "${i##/*}" != "" ];then i=$PWD/../../node_modules/$i;fi; echo $i;yes | cp -f $i build/$C.json.d/;done;)
function transformONSTable4(rangeONS, targetAgeGroup) {
const values = rangeONS;// a 2D array
var newDataMap = {};
// Get the value in each cell, remove apostrophes from the start,
// and replace the value in that cell
for(n in values){
const weekEnding = new Date(values[n][0]).toISOString().slice(0, 10);
const vaxStatus = values[n][2];
const ageGroup = values[n][3];
@hellwolf
hellwolf / send-1559tx.js
Created October 9, 2021 18:28
send-1559tx.js
(async function() {
const provider = new ethers.providers.JsonRpcProvider(PROVIDER_URL);
let wallet = new ethers.Wallet(PRIVATE_KEY);
wallet = wallet.connect(provider);
const tx = await wallet.sendTransaction({
to: "0x07B02d301DE53eb9D1A6B7485Ac2065c53071645",
value: 1e15,
// maxPriorityFeePerGas + baseFeePerGas < maxFeePerGas
maxPriorityFeePerGas: 100e9,
@hellwolf
hellwolf / simple-https-server.py
Created October 9, 2021 18:24
simple-https-server
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import logging
split -v
split -v
focus left
focus left
# eth testnets
screen -t "eth-goerli-1" sh -c "watch -n 5 bash node-status.sh http://eth-goerli-1.web3-nodes.superfluid.dev:8545/"
split
focus down