Skip to content

Instantly share code, notes, and snippets.

@yurenchen000
yurenchen000 / opkg_install_pkg_ver.md
Last active Apr 19, 2020
opkg install specify package version
View opkg_install_pkg_ver.md
@yurenchen000
yurenchen000 / upnp_get_ext_ip.md
Last active Apr 17, 2020
IGD/UPNP client Get ExternalIPAddress
View upnp_get_ext_ip.md

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 Apr 10, 2020
linux ping cmd with timestamp
View ping_with_timestamp.md

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 / go_get_xxx_proxy.sh
Last active Feb 11, 2020
go get xxx with proxy
View go_get_xxx_proxy.sh
# 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 / base64.awk
Last active May 12, 2021
base64 implement in awk & hexdump
View base64.awk
#!/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 / git_config_snip.md
Last active Dec 27, 2019
git config snippets
View git_config_snip.md

show config

git config --global -l

OUT:

@yurenchen000
yurenchen000 / flag_hide_usage.go
Created Dec 26, 2019
goang flag hide cmdline usage & parse err
View flag_hide_usage.go
// golang hide cmdline usage & parse err
flag.CommandLine.SetOutput(ioutil.Discard)
flag.Usage = func() { }
flag.Parse()
@yurenchen000
yurenchen000 / opkg_compare-versions_oddly.md
Last active Dec 21, 2019
opkg compare-versions operator oddly
View opkg_compare-versions_oddly.md

$ opkg --help

compare-versions <v1> <op> <v2>
                    compare versions using <= < > >= = << >>

$ man build_dir/hostpkg/opkg-2017-12-07-3b417b9f/man/opkg-cl.1.in

compare-version <version1> <operator> <version2>
       compare versions using following operators :
View ubuntu14_fix_ssh
sudo ifconfig eth0 mtu 1200
@yurenchen000
yurenchen000 / comm.vimrc
Last active Dec 10, 2019
vimrc snippets
View comm.vimrc
" show line number
set nu
" hi cursor line
set cursorline
"hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white
"hi CursorLine cterm=NONE ctermbg=darkred
" highlight search
se hls