Skip to content

Instantly share code, notes, and snippets.

View BookGin's full-sized avatar
🥁
🎵 🎵 🎵 🎶

bookgin BookGin

🥁
🎵 🎵 🎵 🎶
View GitHub Profile
@BookGin
BookGin / NAT.iptables
Created May 28, 2020 08:55
iptables NAT
WAN="eno1"
LAN="eno2"
sysctl net.ipv4.ip_forward=1
# make sure the default FORWARD policy is DROP
iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT
iptables -A FORWARD -i $WAN -o $LAN -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# NAT
#!/usr/bin/env python3
import ipaddress
ips = [ipaddress.ip_network('0.0.0.0/0')]
exts = map(ipaddress.ip_network
'''
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
127.0.0.0/8
@BookGin
BookGin / solve.sh
Last active December 2, 2020 12:22
Ubuntu 18.04 Bionic Netplan Wifi Not Working
# https://gist.github.com/austinjp/9b968c75c3e54004be7cd7a134881d85
# make sure your wifi SSID and password are correct again
vim /etc/netplan/01-netcfg.yaml
# this package should solve all the problem
apt install wpasupplicant
# generate and apply the config file
netplan apply
# remember to enable the device
ip link set wlp2s0 up
@BookGin
BookGin / segfault.py
Last active December 29, 2019 06:05
Python Segfault
#!/usr/bin/env python3
# https://bugs.python.org/issue22911
[[a.extend([__import__('itertools').chain.from_iterable(a)]),next(*a)]for(a)in[[]]]
@BookGin
BookGin / 臺灣學術倫理教育資源中心 台灣學術倫理教育資訊中心 題庫 答案 解答 .txt
Last active April 3, 2024 22:38
學術倫理 解答,臺灣學術倫理教育資源中心 台灣學術倫理教育資訊中心 題庫 答案 解答 ,請大家留言補充更多解答 或是修正答案 感謝!
使用方法:Ctrl + F 直接輸入題目關鍵字搜尋即可
請大家留言補充更多解答 或是修正答案,感謝各位的貢獻!
臺灣學術倫理教育資源中心
https://ethics.moe.edu.tw/exam/
其他資源:
@BookGin
BookGin / tty.sh
Created June 5, 2019 06:47
Spawn a tty shell
python -c 'import pty;pty.spawn("sh")'
@BookGin
BookGin / firefox-unregister-all-service-workers.js
Last active July 12, 2023 16:10
Unregister all service workers in Firefox.
# navigate to about:debugging#workers first
for (let k of document.getElementsByClassName("unregister-link")) k.click()
for (let k of document.getElementsByClassName("qa-unregister-button")) k.click()
@BookGin
BookGin / pdf2img.sh
Created March 9, 2017 09:25
pdf2img
#!/usr/bin/env bash
if [ $# != 1 ]; then
echo "Usage: $0 [filename]"
exit 1
fi
lastdir=`pwd`
tmpdir=`mktemp -d --suffix=-pdf2img`
echo "temp dir: $tmpdir"
@BookGin
BookGin / IceCTF2016-l33tcrypt-server.py
Created August 29, 2016 15:00
IceCTF 2016 Stage3 l33tcrypt: server.py
#!/usr/bin/python
# IceCTF 2016 - Stage3 - l33tcrypt
# finalC · 182 solves / 1660· Cryptography · 90 pt
#
# l33tcrypt is a new and fresh encryption service.
# For added security it pads all information with the flag!
# Can you get it? nc l33tcrypt.vuln.icec.tf 6001 server.py
# [server.py]: