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
@aadps
aadps / dvr
Last active February 24, 2023 07:06
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
import torch
from torch.optim.optimizer import Optimizer, required
class SGD_MC(Optimizer):
r"""Implements stochastic gradient descent (optionally with momentum).
Nesterov momentum is based on the formula from
`On the importance of initialization and momentum in deep learning`__.
Args:
params (iterable): iterable of parameters to optimize or dicts defining
#!/bin/bash
# Intel MKL is now freely available even for commercial use. This script
# attempts to install the MKL package automatically from Intel's repository.
#
# For manual repository setup instructions, see:
# https://software.intel.com/articles/installing-intel-free-libs-and-python-yum-repo
# https://software.intel.com/articles/installing-intel-free-libs-and-python-apt-repo
#
# For other package managers, or non-Linux platforms, see: