Skip to content

Instantly share code, notes, and snippets.

View aadps's full-sized avatar
🎯
Focusing

Xin Chen aadps

🎯
Focusing
  • AADPS
  • Beijing
View GitHub Profile
#!/bin/bash
sudo apt update
sudo apt install -y vim zsh git goaccess
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add
sudo apt update
sudo apt install -y php-fpm mariadb-server php-mysql php-curl php-xml php-imagick php-mbstring php-zip php-intl mycli
sudo a2enmod proxy_fcgi setenvif rewrite
#!/bin/bash
# Based on: https://gist.github.com/XVilka/8346728
awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
s="/\\";
for (colnum = 0; colnum<term_cols; colnum++) {
r = 255-(colnum*255/term_cols);
g = (colnum*510/term_cols);
b = (colnum*255/term_cols);
if (g>255) g = 510-g;
@aadps
aadps / dvr
Last active June 5, 2024 13:46
IPTV预约录像脚本
#!/bin/bash
m3u="/www/1.m3u"
dvrpath="/mnt/media/"
echo -n "频道名:"
read chan
while [ -z $(cat /www/1.m3u | grep ${chan} -A 1 | head -2 | tail -1) ]; do
echo -n "无此频道,请重新输入:"
read chan
done
@aadps
aadps / apache-pass.conf
Last active September 6, 2021 09:32
Wordpress DDoS filter for fail2ban
[Definition]
failregex = ^<HOST> - - \[\] ".*" 30[12] \d+ ".*" "[^-].*".*$
ignoreregex =
datepattern = ^[^\[]*\[({DATE})
{^LN-BEG}
#!/bin/bash
scp aadps.net:/tmp/db.zip /home/cathiabi/dbback/$(date +%y%m%d).zip
#!/bin/sh
touch /run/tmp
vcgencmd measure_temp | cut -d"=" -f2 > /run/temp
with open("/mnt/dev/lexicon.txt", "r") as file1, open("/mnt/dev/l.txt", "w") as file2:
for line in file1:
items = line.split("\t")
if items[3].startswith("nn"):
items[3] = "1"
elif items[3].startswith("vv"):
items[3] = "2"
elif items[3].startswith("jj"):
items[3] = "3"
elif items[3].startswith("rr"):
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import requests
import os
RED=22
YELLOW=27
GREEN=17
#!/usr/bin/python
import sys
import Adafruit_DHT
import json
import time
from datetime import datetime
def update(hum, temp, t):
with open('/var/www/html/data.json', 'r+') as f:
data = json.load(f)
#!/usr/bin/env python3
import lilcom
import numpy as np
a = np.empty((0))
b = lilcom.compress(a)
assert b[0] == 76