Skip to content

Instantly share code, notes, and snippets.

View benzBrake's full-sized avatar
🏪
忙着赚钱

Ryan Lieu benzBrake

🏪
忙着赚钱
View GitHub Profile
@benzBrake
benzBrake / kcptun-client.service
Created July 5, 2018 07:22
Kcptun Client Service
[Unit]
Description=Kcptun Client Service
After=network.target
[Service]
Type=simple
User=nobody
ExecStart=/etc/kcptun/kcptun_client -c /etc/kcptun/kcptun.conf
Restart=always
RestartSec=5
#!/bin/sh
# $1 is gid.
# $2 is the number of files.
# $3 is the path of the first file.
DOWNLOAD=/data/aria2/download # no trailing slash!
COMPLETE=/data/aria2/gg # no trailing slash!
LOG=/data/aria2/mvcompleted.log
SRC=$3
@benzBrake
benzBrake / functions-diy.php
Created August 28, 2017 12:07
Wordpress 链接HTTPS化处理
/* 替换图片链接为 https */
function my_content_manipulator($content){
if( is_ssl() ){
$content = str_replace('http://doufu.ru/wp-content/uploads', 'https://doufu.ru/wp-content/uploads', $content);
$content = str_replace('http://cdn.doufu.ru/', 'https://cdn.doufu.ru/', $content);
$content = str_replace('http://doufu.ru/sth/', 'https://doufu.ru/sth/', $content);
}
return $content;
}
add_filter('the_content', 'my_content_manipulator');
@benzBrake
benzBrake / functions.php
Last active November 26, 2020 15:10
like single for typecho | Typecho 免插件文章点赞
<?php
function likeSingle($cid) {
$db = likeSingleDb();
if ($db == null) Typecho_Response::throwJson(array('status'=>-1,'msg'=>'数据库有误!'));
$prefix = $db->getPrefix();
if(!cid) Typecho_Response::throwJson(array('status'=>0,'msg'=>'请选择喜欢的文章!'));
$likes = Typecho_Cookie::get('likes');
if(empty($likes)){
$likes = array();
} else {
@benzBrake
benzBrake / a_record_monitor.sh
Last active September 24, 2018 12:37
[DNS]A record monitor, notice you when dns record changed.
#!/bin/bash
# settings start
email="root@localhost"
pin="*/1 * * * *"
# settings end
cron=$1
test -z "$cron" && exit 1
if [ "$cron" != "cron" ]; then
if [ ! -d /etc/arecord_moniter ]; then
CURDIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd )
@benzBrake
benzBrake / list_ssh_ports.sh
Created December 2, 2016 02:16
List SSH Ports
#/bin/bash
SSH_PORTS=`cat /etc/ssh/sshd_config | grep 'Port ' | grep -v '#'`
FIRST_PORT=`echo ${TEST} | head -n 1`
if [ -n ${FIRST_PORT} ];then
echo ${SSH_PORTS}
else
echo 22
fi
@benzBrake
benzBrake / Linux Check Shell
Created November 26, 2016 12:43
linux_check.sh
#/bin/bash
linux_check() {
if $(grep -qi "CentOS" /etc/issue) || $(grep -q "CentOS" /etc/*-release); then
OS="CentOS"
elif $(grep -qi "Ubuntu" /etc/issue) || $(grep -q "Ubuntu" /etc/*-release); then
OS="Ubuntu"
elif $(grep -qi "Debian" /etc/issue) || $(grep -q "Debian" /etc/*-release); then
OS="Debian"
else
cat >&2 <<-'EOF'
@benzBrake
benzBrake / ipip.sh
Created November 23, 2016 06:37
Get IP Location (Data Source: IPIP)
#/bin/sh
ip=$1
echo ${ip}|grep "^[0-9]\{1,3\}\.\([0-9]\{1,3\}\.\)\{2\}[0-9]\{1,3\}$" > /dev/null;
if [ $? -eq 0 ]
then
result=`curl "http://ip.huomao.com/ip?ip=${ip}" 2>/dev/null`
result=${result:1:(-1)}
country=`echo ${result} | awk -F, '{ print $1}' | awk -F: '{ print $2}'`
province=`echo ${result} | awk -F, '{ print $2}' | awk -F: '{ print $2}'`
city=`echo ${result} | awk -F, '{ print $3}' | awk -F: '{ print $2}'`
@benzBrake
benzBrake / Baidu Light
Last active June 12, 2016 14:00 — forked from funsunz/no_ad_baidu.css
百度轻样式
body {
overflow-x: hidden;
min-width: 600px;
background-color: #F7F7F7
}
#container {
width: 100%
}
#content_right {
display: none
@-moz-document domain("github.com") {
a[href$=".sh"]::before {
content:url("moz-icon://.sh?size=16");
}
a[href$=".js"]::before {
content:url("moz-icon://.js?size=16");
}
}