Skip to content

Instantly share code, notes, and snippets.

View yongkangchen's full-sized avatar

Yongkang Chen yongkangchen

View GitHub Profile
@yongkangchen
yongkangchen / INSTALL.markdown
Last active August 29, 2015 13:58 — forked from Suor/INSTALL.markdown
sublimetext open file at cursor

Open keyboard bindings file, and add a line to it

[
    ...
    { "keys": ["alt+o"], "command": "open_file_at_cursor" } // this one
]
@yongkangchen
yongkangchen / LuaParseCheck.py
Created May 19, 2014 13:41
lua syntax check when save lua file in sublime
import sublime, sublime_plugin
import os
import re
regex = re.compile('.*:(\d+):.*')
class LuaParseCheck(sublime_plugin.EventListener):
def on_post_save_async(self, view):
path = view.file_name()
if os.path.splitext(path)[-1] != ".lua":return
result = os.popen("/usr/local/bin/luac -p '"+path+"' 2>&1").read()

$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /' > users.txt

$ vi users.txt

$ git svn init ${svn_url} --no-metadata

$ git svn fetch --authors-file=users.txt

$ vi .gitignore

@yongkangchen
yongkangchen / test.cs
Created May 14, 2015 09:49
How does Unity null all references to a GameObject after Object.Destroy is called on it?
using UnityEngine;
public class Main : MonoBehaviour {
void Start ()
{
FakeObject obj = new FakeObject ();
Debug.LogError (obj); // [FakeObject]
Debug.LogError (obj == null); // false
Debug.LogError (obj.num); //100
---- TRACE 1 start vector3.lua:14
0008 UGET 5 0 ; Vector3
0009 KSHORT 6 0
0010 KSHORT 7 1
0011 KSHORT 8 0
0012 CALL 5 2 4
0000 . FUNCF 7 ; vector3.lua:6
0001 . UGET 4 0 ; setmetatable
0002 . TNEW 5 4
0003 . ISTC 6 1
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
useradd shadowsocks
read -p "input shadowsocks password: " SS_PASSWORD
CONFIG_FILE=/etc/shadowsocks.json
SERVICE_FILE=/etc/systemd/system/shadowsocks.service
@yongkangchen
yongkangchen / ctags lua 规则增强
Last active October 29, 2021 11:21
ctags lua 规则增强
--regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+):([a-zA-Z0-9_]+).*$/\2/f,function/
--regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+).*$/\2/f,function/
--regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\s*\(.*$/\1/f,function/
--regex-LUA=/([a-zA-Z0-9_]+) = require[ (]"([^"]+)"/\1/r,require/
--regex-LUA=/[ \t]{1}([a-zA-Z0-9_]+)[ \t]*[=][^=]/\1/v,variable/
--regex-LUA=/[ \t]*([a-zA-Z0-9_]+)[ \t]*=[ \t]*module_define.*$/\1/m,module/
--regex-LUA=/func_table\[ msg\.([A-Z_]+) \].+/\1/
@yongkangchen
yongkangchen / atom.js
Last active September 13, 2022 13:15
boom!!! Here is a hack solution to make atom start faster. For Atom <= v0.170.0
Atom.prototype.startEditorWindow = function() {
var CommandInstaller, dimensions, maximize, resourcePath, safeMode, _ref;
_ref = this.getLoadSettings(), resourcePath = _ref.resourcePath, safeMode = _ref.safeMode;
CommandInstaller = require('./command-installer');
CommandInstaller.installAtomCommand(resourcePath, false, function(error) {
if (error != null) {
return console.warn(error.message);
}
});
CommandInstaller.installApmCommand(resourcePath, false, function(error) {
@yongkangchen
yongkangchen / readme
Last active March 20, 2023 02:12
apache2+cgi
apache2 conf:
<VirtualHost *:80>
DocumentRoot /var/www/html/cgidir
<Directory "/var/www/html/cgidir">
AllowOverride All
</Directory>
</VirtualHost>
@yongkangchen
yongkangchen / pip.conf
Created June 12, 2023 04:44
aliyun.mirror.pip
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com