Skip to content

Instantly share code, notes, and snippets.

View kj54321's full-sized avatar
🤠

Donny Jie kj54321

🤠
View GitHub Profile
@kj54321
kj54321 / set-apt-proxy.md
Created March 6, 2023 13:36 — forked from wonderbeyond/set-apt-proxy.md
[ubuntu][socks5][proxy] Set proxy for apt

Writing an apt proxy conf file /etc/apt/apt.conf.d/proxy.conf as below.

Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
Acquire::socks::Proxy "socks5h://127.0.0.1:1080";

And the proxy settings will be applied the next time we run apt.

@kj54321
kj54321 / ddolauncher.sh
Created August 13, 2020 13:23
DDO game launcher for Mac/Linux wine64
#!/bin/bash
# Launch LOTRO client from CLI.
#
# To be used
# with cygwin on windows if you just can't stand .NET
# or with wine/cedega under GNU/Linux or *BSD
# to play The Lord of the Rings Online: Shadows of Angmar.
#
#
@kj54321
kj54321 / networkCommand.md
Created November 10, 2019 09:44 — forked from raulmoyareyes/networkCommand.md
Linux command to check Internet connection speed.

# View public IP

  • curl -s checkip.dyndns.org | sed 's#.Address: (.)</b.*#\1#'
  • wget -qO - icanhazip.com
  • curl ifconfig.me
  • curl ident.me
  • dig +short myip.opendns.com @resolver1.opendns.com
  • lynx -dump ifconfig.me | grep 'IP Address'
  • curl ipecho.net/plain
  • curl bot.whatismyipaddress.com
  • curl ipinfo.io
@kj54321
kj54321 / socks-create.sh
Created November 7, 2019 14:19 — forked from AfroThundr3007730/socks-create.sh
Create an on-demand SSH-based SOCKS5 proxy via systemd socket activation
#!/bin/bash
# These steps will allow the setup of an on-demand SSH proxy
# Three unit files will be created to serve this purpose:
# ssh-socks-helper.socket - The listening socket providing activation
# ssh-socks-helper.service - A systemd proxy to pass the socket fd
# ssh-socks.service - The actual SSH service providing the tunnel
cat <<'EOF' > ~/.config/systemd/user/ssh-socks-helper.socket
[Unit]
Description=Proxy Helper Socket for Bastion SOCKS5 Proxy
@kj54321
kj54321 / 1-redsocks2-openwrt.md
Created October 29, 2019 08:13 — forked from lanceliao/1-redsocks2-openwrt.md
在OpenWrt上配置redsocks2

redsocks2是一款透明socks5代理工具,能够实现智能代理的功能,这里是redsocks2在OpenWrt上的配置,配合shadowsocks使用。

redsocks.conf 是配置文件,放在/etc目录,将192.168.1.1改成路由器的地址. redsocks2.sh 为自启动文件,改名为redsocks2放到/etc/init.d目录即可。自启动文件假设redsocks可执行文件在/opt/bin目录。

启动redsocks2: /etc/init.d/redsocks2 start 停止redsocks2: /etc/init.d/redsocks2 stop

redsocks2 git源

@kj54321
kj54321 / route_wifi.sh
Created July 31, 2019 04:15 — forked from cpthooch/route_wifi.sh
Routing all traffic to particular IP address via wifi network interface on MacOS
#!/bin/bash
# NOTE: wifi network interface is: en1
wifi_router=192.168.200.1
wifi_address=en1:ec.35.86.4f.00.bc
TOADDR=`ifconfig en1 inet | sed -nl 's/\w*inet \([^ ]*\).*/\1/p'`
TO=`echo -n ${TOADDR//[[:space:]]}`
echo "ADDING ROUTE TO $1 VIA en1 (wi-fi): $TO"
route -n add -host $1 $wifi_router -ifp $wifi_address -ifa $TO -static
Example infrastructure outage incident report
Friday, May 13, 2077
By the Example Security Team
Earlier this week we experienced an outage in our API infrastructure. Today we’re providing an incident report that details the nature of the outage and our response.
The following is the incident report for the Example Security outage that occurred on April 30, 2077. We understand this service issue has impacted our valued developers and users, and we apologize to everyone who was affected.
@kj54321
kj54321 / crawler_for_taichung.py
Created March 17, 2019 03:04 — forked from devjoe/crawler_for_taichung.py
範例程式碼:從蟒蛇到神龍 - 從 1 接關繼續打造爬蟲程式 @ 台中拍聚會
# -*- coding: utf-8 -*-
target_url = "https://www.khanacademy.org/"
# -------------------------------------------------------
import whois
#print whois.whois(target_url)
@kj54321
kj54321 / iptables.sh
Created June 25, 2018 14:04 — forked from Tristor/iptables.sh
Simple IPtables script for an OpenVPN server
#!/bin/bash
# Flushing all rules
iptables -F FORWARD
iptables -F INPUT
iptables -F OUTPUT
iptables -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
@kj54321
kj54321 / bgpd.conf
Created June 1, 2018 18:30 — forked from heri16/bgpd.conf
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates