View taichi_zoo_3body.py
This file contains 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 taichi as ti | |
ti.init(arch=ti.gpu) | |
n = 320 | |
pixels = ti.field(dtype=float, shape=(n * 2, n)) | |
@ti.func | |
def complex_sqr(z): | |
return ti.Vector([z[0]**2 - z[1]**2, z[1] * z[0] * 2]) |
View i.sh
This file contains 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
# https://github.com/x-wrt/x-wrt.github.io/tree/master/docs/install-on-vps | |
# Aliyun install script | |
if [ ! -f /root/x-wrt.img.gz ]; then | |
wget -O /root/x-wrt.img.gz --no-check-certificate https://downloads.x-wrt.com/rom/x-wrt-8.0-b202005101652-x86-64-generic-ext4-combined.img.gz | |
sed -i "s/errors\=remount-ro/ro/g" /etc/fstab | |
reboot | |
fi | |
vda1=`df -h|awk '{ if ($6 == "/") print $1 }'` |
View LRUCache.py
This file contains 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
class LRUCache(collections.OrderedDict): | |
def __init__(self, capacity: int): | |
self.maxsize = capacity | |
def get(self, key: int) -> int: | |
if key in self: | |
value = super().__getitem__(key) | |
self.move_to_end(key) |
View extract-testflight.js
This file contains 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
//Make sure you scroll down to get all data loaded | |
var text = ''; | |
$('.col-email').each(function(index,el) { | |
if (index == 0) { | |
text = 'Email, First Name, Last Name\n'; | |
} | |
else { | |
text = text + $.trim($(el).find("a").text()) + ','; | |
//First Name |
View ssserver.sh
This file contains 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
#Ubuntu 16.04 | |
apt install -y python-pip | |
apt install -y libsodium-dev | |
pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip |
View iptables.conf
This file contains 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
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT | |
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT | |
iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT | |
iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset | |
iptables -A FORWARD -p tcp --dport 80 -j ACCEPT | |
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT | |
iptables -A FORWARD -p tcp -j REJECT --reject-with tcp-reset |
View checkExpiredDomains.py
This file contains 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 socket | |
import pprint | |
import sys | |
import os | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--input', default='') | |
parser.add_argument('--output', default='output.txt') | |
args = parser.parse_args() |
View worker nginx conf
This file contains 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
resolver 8.8.8.8; | |
location /video/ { | |
if ($request_uri ~ "^/video/(.+?)/.+") { | |
set $upstream_host $1.googlevideo.com; | |
add_header Content-Disposition "attachment; filename=video.mp4;"; | |
} | |
rewrite /video/.+?/(.+)$ /$1 break; | |
proxy_buffering off; | |
proxy_pass https://$upstream_host; | |
proxy_set_header Host $upstream_host; |
View repo-rinse.sh
This file contains 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
git clean -xfd | |
git submodule foreach --recursive git clean -xfd | |
git reset --hard | |
git submodule foreach --recursive git reset --hard | |
git submodule update --init --recursive |
View random_multi_select.py
This file contains 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 random | |
random.sample(range(1,201), 20) |
NewerOlder