Skip to content

Instantly share code, notes, and snippets.

View yurenchen000's full-sized avatar
😶‍🌫️
may be slow to respond.

yurenchen000

😶‍🌫️
may be slow to respond.
View GitHub Profile
@yurenchen000
yurenchen000 / github_md_toc_maximize.md
Created December 29, 2022 15:22
github readme.md toc maximize

Recently github has a very cramped TOC size,
Some pages are very difficult to read.

this script (paste and run in browser F12)
help maximize the TOC div size.

//github readme.md toc maximize
with(document.querySelector('readme-toc .SelectMenu-modal.mt-1').style){
 maxHeight=(document.documentElement.clientHeight-40)+'px'
@yurenchen000
yurenchen000 / opkg_install_pkg_ver.md
Last active February 20, 2023 20:05
opkg install specify package version
@yurenchen000
yurenchen000 / close_chan_emulate_broadcast.md
Last active September 3, 2022 19:37
golang_close_chan_emulate_broadcast

go chan broadcast

chan close to emulate broadcast

if only want signal (without pass value), wait channel close can do the trick:

@yurenchen000
yurenchen000 / base64.awk
Last active May 13, 2022 23:29
base64 implement in awk & hexdump
#!/usr/bin/awk -f
# from https://sites.google.com/site/dannychouinard/Home/unix-linux-trinkets/little-utilities/base64-and-base85-encoding-awk-scripts
#
# compatible with busybox:
# no od, awk not print \0
function encode64() {
while( "hexdump -e ' \"%07.7_ax \" 16/1 \"%02x \" \"\n\"'" | getline ) {
for(c=9; c<=length($0); c++) {
d=index("0123456789abcdef",substr($0,c,1));
@yurenchen000
yurenchen000 / go_get_xxx_proxy.sh
Last active March 30, 2022 09:10
go get xxx with proxy
# http*_proxy
export http_proxy=socks5://proxyAddress:port
export https_proxy=socks5://proxyAddress:port
# OR all_proxy
export all_proxy=socks5://proxyAddress:port
# ----------------
@yurenchen000
yurenchen000 / config
Last active August 21, 2021 19:44
terminator_custom_ui_theme.md
### title bar color
# edit ~/.config/terminator/config
# or set in Preferences
[global_config]
inactive_color_offset = 0.939102564103
scroll_tabbar = True
title_inactive_bg_color = "#555753"
title_inactive_fg_color = "#888a85"
title_transmit_bg_color = "#75507b"
@yurenchen000
yurenchen000 / upnp_get_ext_ip.md
Last active April 17, 2020 16:28
IGD/UPNP client Get ExternalIPAddress

upnp get ext ip

IGD/UPNP get ExternalIPAddress of upper router

A. upnpc cmd

$ upnpc -s | grep ExternalIPAddress
ExternalIPAddress = 192.168.199.121
@yurenchen000
yurenchen000 / ping_with_timestamp.md
Created April 10, 2020 17:19
linux ping cmd with timestamp

https://askubuntu.com/a/400273/413480

1. time from ping -D

Another possibility to use the ping -D option which gets you the timestamp as Unix time.

tilo@t-ubuntu:~$ ping google.com -D
PING google.com (173.194.33.73) 56(84) bytes of data.
[1388886989.442413] 64 bytes from sea09s15-in-f9.1e100.net (173.194.33.73): icmp_req=1 ttl=57 time=11.1 ms
[1388886990.443845] 64 bytes from sea09s15-in-f9.1e100.net (173.194.33.73): icmp_req=2 ttl=57 time=11.0 ms
@yurenchen000
yurenchen000 / git_config_snip.md
Last active December 27, 2019 10:11
git config snippets

show config

git config --global -l

OUT:

@yurenchen000
yurenchen000 / flag_hide_usage.go
Created December 26, 2019 04:36
goang flag hide cmdline usage & parse err
// golang hide cmdline usage & parse err
flag.CommandLine.SetOutput(ioutil.Discard)
flag.Usage = func() { }
flag.Parse()