Skip to content

Instantly share code, notes, and snippets.

View licsber's full-sized avatar
👀
Study every second

Jiale Liu licsber

👀
Study every second
View GitHub Profile
@licsber
licsber / iKuai.sh
Created October 4, 2021 04:34
自动检测有无网络 并发送推送/重启虚拟机
#!/usr/bin/env bash
DATE=$(date '+%Y-%m-%d %H:%M')
function network() {
local timeout=2
local target=www.baidu.com
local code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
if [ "Licsber$code" = "Licsber200" ]; then
return 1
else
import aip
APP_ID = '1'
API_KEY = '2'
SECRET_KEY = '3'
def run_all(c, start=0):
dirs = dir(c)
print(len(dirs))
@licsber
licsber / Dockerfile
Created March 9, 2021 12:26
docker 容器化部署 kodexplorer
FROM php:7.3-fpm-alpine
LABEL MAINTAINER licsber@gmail.com
RUN set -x \
&& apk add --no-cache --update \
freetype libpng libjpeg-turbo \
freetype-dev libpng-dev libjpeg-turbo-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j "$(getconf _NPROCESSORS_ONLN)" gd \
@licsber
licsber / mkiso.py
Created January 19, 2021 14:18
自动归档
#!/usr/bin/env python3
import os
os.chdir(os.path.split(os.path.realpath(__file__))[0])
# 目录下如果存在日语
# os.system("nfd2nfc ./")
for i in os.listdir('.'):
#!/usr/bin/env bash
sudo docker run --rm -d \
--name=pt \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-e WEBUI_PORT=9000 \
-p 9000:9000 \
-p 46000:46000 \
-p 46000:46000/udp \
🎮 Don't Starve Together 🕘 118 hrs 19 mins
🎮 Clicker Heroes 🕘 69 hrs 42 mins
🎮 Portal 2 🕘 67 hrs 12 mins
🎮 Human: Fall Flat 🕘 18 hrs 51 mins
🎮 Left 4 Dead 2 🕘 17 hrs 18 mins
@licsber
licsber / downloader.py
Created June 4, 2020 16:10
python写的一个多线程爬虫 用时五分钟
import threading
import requests
import urllib3
import queue
import os
urllib3.disable_warnings()
class Downloader:
@licsber
licsber / flatten.py
Created May 29, 2020 07:26
python 平展 语法糖演示
b = [[1, 2], [3], [[1, [2]]]]
flatten1 = lambda x: [y for l in x for y in flatten1(l)] if type(x) is list else [x]
def flatten2(x):
res = []
if type(x) is list:
for l in x:
for y in flatten2(l):
@licsber
licsber / 删除git历史中误提交的文件或者大文件.sh
Created May 8, 2020 08:06
删除git历史中误提交的文件或者大文件
git filter-branch -f --prune-empty --index-filter "git rm -rf --cached --ignore-unmatch filename" --tag-name-filter cat -- --all
@licsber
licsber / calculate_file_and_dir_count.py
Created April 29, 2020 02:54
计算文件夹中的文件数和目录数 用于坚果云同步
import os
dirs = []
files = []
def walk(file):
if os.path.isdir(file):
dirs.append(file)
for f in os.listdir(file):
walk(file + '/' + f)