Skip to content

Instantly share code, notes, and snippets.

View kookxiang's full-sized avatar
🪲
code once, bug everywhere

Xiang Liu kookxiang

🪲
code once, bug everywhere
View GitHub Profile
<?php
class PHPLock {
private $_PHP_LOCK = array();
private $code;
private $lockId = 1;
public function __construct(&$code){
$this->code =& $code;
$this->_PHP_LOCK = array();
@kookxiang
kookxiang / Database.php
Last active September 24, 2019 11:45
PDO with multi server support
<?php
/**
* This file is a part of KK Framework
* Author: kookxiang <[email protected]>
*/
namespace Core;
class Database {
const MASTER = 'MASTER';
const SLAVE = 'SLAVE';
@kookxiang
kookxiang / SS-Redir.sh
Created October 6, 2015 06:47
SS-Redir config file for OpenWRT
#!/bin/sh
# Notice: hosts file is required
killall ss-redir > /dev/null
ss-redir -v -c /etc/ss-redir.json &
iptables -t nat -N SHADOWSOCKS > /dev/null
iptables -t nat -F SHADOWSOCKS > /dev/null
@kookxiang
kookxiang / cnmp.sh
Last active April 28, 2020 15:34
CNMP (Centos 7 + Nginx + MariaDB + PHP7) Install Script
#!env bash
installCNMP(){
if [[ -e /etc/redhat-release ]]; then
RELEASE_RPM=$(rpm -qf /etc/centos-release)
RELEASE=$(rpm -q --qf '%{VERSION}' ${RELEASE_RPM})
if [ ${RELEASE} != "7" ]; then
echo "Not CentOS release 7."
exit 1
fi
else
#!/usr/bin/env bash
# Usage:
# $(curl -sSL https://gist.githubusercontent.com/kookxiang/2fb6d9e3f811f59f0b3c2c4353161f64/raw/centos7_init.sh | bash)
if [[ -e /etc/redhat-release ]]; then
RELEASE_RPM=$(rpm -qf /etc/centos-release)
RELEASE=$(rpm -q --qf '%{VERSION}' ${RELEASE_RPM})
if [ ${RELEASE} != "7" ]; then
echo "CentOS release is not 7."
@kookxiang
kookxiang / hackQQ.sh
Last active October 8, 2024 11:48
一键得到一个精简版的手机QQ(Android)
#!/system/bin/sh
# 使用方法:
# adb shell "curl -Ssl https://gist.githubusercontent.com/kookxiang/1104e898f270c9a7a0784f70979ec532/raw/hackQQ.sh | su"
# 使用方法 (手动):
# 0.确保你手机 Root 了
# 1.下载这个脚本到某个地方
# 2.下载 Android SDK(需要其中的 adb)
# 3.在命令行运行 adb devices,确保能看到你的手机
#!/usr/bin/env sh
TARGET_DIR='/home/kookxiang/.ssh'
GITHUB_USERNAME='kookxiang'
if ! [ -d ${TARGET_DIR} ]; then
mkdir ${TARGET_DIR}
chmod 0700 ${TARGET_DIR}
fi
if ! [ -f ${TARGET_DIR}/authorized_keys ]; then
@kookxiang
kookxiang / snow.css
Last active December 23, 2017 17:54
Snow Effect for Winter~ (aka White Album Season)
body {
margin: 0;
background: #202020;
}
body > .snow {
display: block;
position: fixed;
z-index: 1000;
top: 0;

Keybase proof

I hereby claim:

  • I am kookxiang on github.
  • I am kookxiang (https://keybase.io/kookxiang) on keybase.
  • I have a public key ASCYbL9eMKBZFMhA4_L3_OE4dn2uwaH2tWkL1K3B6_NfyQo

To claim this, I am signing this object:

@kookxiang
kookxiang / ddns.sh
Last active July 24, 2020 09:22
simple ddns script for cloudflare
#!/usr/bin/env bash
set -e
CF_TOKEN="********************************"
CF_ZONEID="*************************"
while true
do
sleep 10