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 | |
date +'%Y-%m-%d %H:%M:%S' | |
~/bin/perf stat -I 1000 -e cycles,instructions,context-switches -p $1 # 4069 |
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
" Format all the word into title cases | |
:%s/\(^\s*title.*\)\@<=\v<(.)(\w*)/\u\2\3/g | |
" Change short words back | |
:%s/\(^\s*title.*\)\@<=\(:\s*\|{\)\@<!\v<(And|As|But|For|If|Nor|Or|So|Yet|A|An|The|As|At|By|For|In|Of|Off|On|Per|To|Up|Via)>/\L\0/g |
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
plt.gca().set_axis_off() | |
plt.subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0) | |
plt.margins(0, 0) | |
plt.gca().xaxis.set_major_locator(plt.NullLocator()) | |
plt.gca().yaxis.set_major_locator(plt.NullLocator()) | |
plt.savefig(f"filename.png", transparent=True, bbox_inches="tight", pad_inches=0) | |
plt.cla() |
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
nmcli connection add \ | |
type ip-tunnel ifname he-sit \ | |
mode sit remote 66.220.18.42 -- \ | |
ipv4.method disabled ipv6.method manual \ | |
ipv6.address 2001:470:c:2c3::2/64 \ | |
ipv6.gateway 2001:470:c:2c3::1 | |
wget -O /dev/null https://$USER:[email protected]/nic/update?hostname=$TUNNEL_ID |
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 multiprocessing | |
def __parallel_handle(f, q_in, q_out): | |
while True: | |
i, x = q_in.get() | |
if i is None: | |
break | |
q_out.put((i, f(x))) |