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
| #!/usr/bin/env python3 | |
| now = 0 | |
| full = 0 | |
| with open('/sys/class/power_supply/BAT1/energy_now') as fp: | |
| now = float(fp.read()) | |
| with open('/sys/class/power_supply/BAT1/energy_full') as fp: | |
| full = float(fp.read()) | |
| per = str(int(now * 100/ full)) |
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
| #!/usr/bin/env python3 | |
| import os | |
| import sys | |
| dir = "/sys/class/backlight/amdgpu_bl0" | |
| maxb = 1000 | |
| with open(dir + '/max_brightness') as fp: | |
| maxb = int(fp.read()) |
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
| \documentclass{article} | |
| \usepackage{hyperref} | |
| \usepackage{indentfirst} | |
| \usepackage{xeCJK} | |
| \setcounter{secnumdepth}{0} | |
| \setlength{\parindent}{2em} | |
| \setlength{\parskip}{1em} | |
| \setmainfont{DejaVu Serif} | |
| \setCJKmainfont{Source Han Serif CN} |
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
| IPT=iptables | |
| SUB_NET=10.0.0.0/24 | |
| IN_FACE=eth0 | |
| WG_FACE=wg0 | |
| WG_PORT=51580 | |
| $IPT -t nat -I POSTROUTING 1 -s $SUB_NET -o $IN_FACE -j MASQUERADE | |
| $IPT -I INPUT -i $WG_FACE -j ACCEPT | |
| $IPT -I FORWARD -i $IN_FACE -o $WG_FACE -j ACCEPT | |
| $IPT -I FORWARD -i $WG_FACE -o $IN_FACE -j ACCEPT |
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
| // Build in MinGW64: gcc -static -mwindow launcher.c -o launcher.exe | |
| #include <stdbool.h> | |
| #include <stdio.h> | |
| #include <Processthreadsapi.h> | |
| #include <Windows.h> | |
| void ErrorExit(LPTSTR lpszFunction) | |
| { | |
| // Retrieve the system error message for the last-error code |
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
| Host git.st.ht | |
| ProxyCommand nc --proxy-type socks5 --proxy 127.0.0.1:1080 %h %p |
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 | |
| # Usage: ./showtex.sh 'E=mc^2' | |
| tmp=/tmp/$(head -c 5 /dev/urandom | base32) | |
| tex2svg $@ > $tmp.svg && \ | |
| convert -resize 150% $tmp.svg $tmp.png && \ | |
| img2sixel $tmp.png |
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 | |
| chipset="type=q35,kernel_irqchip=on,mem-merge=on" | |
| vcpu="host" | |
| hyper="kvm,thread=multi" | |
| CPU_SOCKETS="1" | |
| CPU_CORES="4" | |
| CPU_THREADS="4" | |
| exec qemu-system-x86_64 \ |
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
| #!/usr/bin/env python3 | |
| # Render equations in $$...$$ or $...$ in markdown to svg | |
| # Depend on command `tex2svg` | |
| # To install: `sudo npm install -g mathjax-node-cli` | |
| import sys | |
| instr = sys.stdin.read() |
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 | |
| deviceid=$(xinput |grep Touchpad | awk -F= '{print $2}'| awk '{print $1}') | |
| propid=$(xinput list-props $deviceid | grep "Tapping Enabled (" | awk -F"[()]" '{print $2}') | |
| xinput set-prop $deviceid $propid 1 |
OlderNewer