Skip to content

Instantly share code, notes, and snippets.

View tru2dagame's full-sized avatar
💭
🏀

Tru tru2dagame

💭
🏀
  • Ubiquiti
  • Shanghai
View GitHub Profile
@tru2dagame
tru2dagame / LICENSE.txt
Created January 10, 2016 05:36 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tru2dagame
tru2dagame / surge.conf
Created October 5, 2015 17:05
Yet another config for Surge.app
[General]
# warning, notify, info, verbose
loglevel = notify
[Proxy]
# http, https, socks5
# SSLedge 代理推荐使用 TLS_RSA_WITH_AES_128_GCM_SHA256 Ciphers
Proxy = custom, 1.2.3.4, 443, rc4-md5, password, http://server/custom.module
[Rule]
@tru2dagame
tru2dagame / surge.conf
Created October 4, 2015 17:39 — forked from janlay/README.md
Yet another config for Surge.app
# This config file was created for myself (@janlay). You may want to add or remove some rules to make efficient use of the Internet.
[General]
# warning, notify, info, verbose
loglevel = notify
[Proxy]
# http, https, socks5
Proxy = custom, 1.2.3.4, 443, rc4-md5, password, http://server/custom.module
@tru2dagame
tru2dagame / post-receive.md
Last active August 29, 2015 14:24
GIT hooks post-receive

GIT hooks

post-receive

#!/bin/sh
cd /path/to/working-copy/ || exit
unset GIT_DIR
git pull

exec git-update-server-info
@tru2dagame
tru2dagame / uninstall_mysql.md
Last active August 29, 2015 14:12
uninstall mysql from dev.mysql.com on a Mac OS X

To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:

. Open a terminal window
. Use mysqldump to backup your databases to text files!
. Stop the database server
. sudo rm /usr/local/mysql
. sudo rm -rf /usr/local/mysql*
. sudo rm -rf /Library/StartupItems/MySQLCOM
. sudo rm -rf /Library/PreferencePanes/My*

. edit /etc/hostconfig and remove the line MYSQLCOM=-YES-

@tru2dagame
tru2dagame / check_nohup_sh.md
Last active August 29, 2015 14:09
Check the nohup to see if works well.

check_nohup.sh

#!/bin/bash
if
ps -ef | grep "send_confirm.php" | grep -v "grep"
then
echo “Running!”
else
echo “Stopped!”

cd /var/www/bdev/ubnt_email

@tru2dagame
tru2dagame / update_nodejs.md
Last active August 29, 2015 14:08
UPDATE NodeJS and npm

Update NodeJS

Update NodeJS to the latest stable version

➜  ~  sudo npm cache clean -F
➜  ~  sudo npm install -g n
➜  ~  sudo n stable

Then:

➜ ~ node -v

@tru2dagame
tru2dagame / apache_htaccess.md
Created October 23, 2014 06:58
apache htaccess for url query string

.htaccess Example for URL liks this

www.xxx.com/guest/s/default/?id=baba&query=sth

.htaccess

# apache rewrite rule
RewriteEngine On
RewriteCond $1 !^(index\.php|rewrite\.php)

RewriteRule ^guest/s/([^/])/(.)$ rewrite.php?site=$1&$2 [QSA]

@tru2dagame
tru2dagame / git assume unchanged.md
Last active March 17, 2023 12:55
git update-index --assume-unchanged

Ignore the file that Git has tracked already

git update-index --assume-unchanged <FileName>

Show all the files that you have assumed before in case you forgot them

git ls-files -v | grep h\ 

It will show:

h .gitignore

h config.php

@tru2dagame
tru2dagame / convert_csv_string_to_array.php
Created August 19, 2014 10:15
php convert csv string to array
<?php
function convert_csv_string_to_array($csvstring) {
$lines = explode(PHP_EOL, current($csvstring));
$array = array();
foreach ($lines as $key => $line) {
if (substr(trim($line), -1) == ',') {
$line = substr(trim($line), 0, -1);
}
if ($key == 0) {
$head = str_getcsv($line);