Skip to content

Instantly share code, notes, and snippets.

View hellwolf's full-sized avatar

Miao ZhiCheng hellwolf

View GitHub Profile
@hellwolf
hellwolf / nixos-tip__.gitconfig
Last active April 29, 2024 03:54
[NixOS Tip]: configure git credential to use libsecret on NixOS
[user]
email = your email
name = your name
signingkey = xxxxxxxx
[credential]
helper = /run/current-system/sw/bin/git-credential-libsecret
# make sure you have gitFull installed on NixOS
@hellwolf
hellwolf / activate.sh
Created March 9, 2024 00:28
macos gnu coreutils wrappers
PATH=~/Applications/gnu-coreutils-wrappers/bin:$PATH
@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 / toggle-sticky-terminal.sh
Created September 5, 2023 20:41
Toogle sticky gnome terminal
#!/usr/bin/env bash
# Usage: toggle-sticky-terminal.sh [above|below]
set -x
STATUS_FILE=$XDG_RUNTIME_DIR/sticky-terminal-status.json
setup() {
gnome-terminal --profile=scratchpad
@hellwolf
hellwolf / Dockerfile
Created August 6, 2023 09:44
docker-image-urbit
FROM nixos/nix
RUN nix-channel --update
RUN nix-env -i urbit
CMD ["sh", "-c", "urbit -t /var/lib/urbit"]
@hellwolf
hellwolf / hello_world.hs
Last active July 24, 2023 20:02
Hypothetical hscript
#!/usr/bin/env hsh
-- a. The file name should probably be ".hs", but it's nice to have all the syntax highlitng for free using ".hs".
-- b. it works by having a shell running as a separate process, while the hscript process piping stuff from these quasi-quote
-- template haskell outputs to the shell.
-- c. `hsh` preprocessor reduces some boiler plate, so it is extremely terse to start your helloworld program!
-- d. Otherwise it all looks your regular Haskell program, feel free to add 20+ more GHC extensions.
banner s = "hello world, " <> s
@hellwolf
hellwolf / gist:12cb9de7c7487496217afcf988f6739f
Created July 24, 2023 17:55
Find all the libraries with external/public functions
$ git grep -lE '^library' contracts/ | while read i;do grep -E 'public|external' -lE $i | xargs grep -hoE '^library\s+\w+';done | sort | uniq
@hellwolf
hellwolf / abi-to-sol.js
Last active June 9, 2023 15:14
Convert ABI to solidity file
/**
* Convert ABI json file to solidity interface contract
*/
const fs = require('fs');
const args = process.argv.slice(2);
function convert(inputFilename) {
const abi = JSON.parse(fs.readFileSync(inputFilename, 'utf8'));
@hellwolf
hellwolf / trace-symlink
Created March 27, 2023 11:58
Nix Helpers: trace-symlink & trace-which