Skip to content

Instantly share code, notes, and snippets.

View ETiV's full-sized avatar
🛥️
船迟又遇打头风

ETiV

🛥️
船迟又遇打头风
  • Shanghai, China
  • 23:33 (UTC +08:00)
View GitHub Profile
@ETiV
ETiV / pomelo_filter_template.js
Last active December 15, 2015 13:19
A template of filter for pomelo framework.
/**
* Filter
*/
module.exports = function() {
return new Filter();
};
var Filter = function() {
};
@ETiV
ETiV / Vim-Run-NodeJS.vim
Created April 11, 2013 18:32
run the current js file by pressing F2 key with nodejs
autocmd filetype javascript map <F2> :!node "%:p"<CR>
@ETiV
ETiV / goagent.plist
Created April 23, 2013 04:21
my goagent auto launch configuration file of osx. under path "/Library/LaunchDaemons". to check run `launchctl list | grep GoAgent`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>GoAgent</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python</string>
@ETiV
ETiV / invoke_callback.js
Created May 6, 2013 09:10
javascript invoke callback
var __callback = function (cb) {
if (typeof cb == 'function') {
delete arguments['0'];
var args = [];
for (var key in arguments) {
if (arguments.hasOwnProperty(key)) {
args.push(arguments[key]);
}
}
cb.apply(null, args);
@ETiV
ETiV / build_md5_for_directory.sh
Last active December 17, 2015 05:39
要点: find 的 -exec 可以出现很多次. 并依出现次序执行命令
#!/bin/sh
cd "$1"
#find * -type f -print0 | xargs -0 $DIR/digest.sh
find * -name "*" -type f -exec stat --printf='%s ' '{}' \; -exec md5sum '{}' \;
cd - > /dev/null
@ETiV
ETiV / OptionHandlerFactory.cc
Created June 3, 2013 16:31
aria2 server connection unlimit.
/**
* vim OptionHandlerFactory.cc
* /PREF_MAX_CONNECTION_PER_SERVER
* change the next line `1, 16,` to `1, -1`
* :wq
*/
// then make
@ETiV
ETiV / CentOS-Install-gitlab_ci.sh
Last active March 11, 2021 15:28
Install gitlab-ci on CentOS. I've installed on CentOS 6.4 64bit.
#!/bin/sh
rpm -Uih https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
curl -L https://get.rvm.io | bash -s stable
rvm install 2.0.0
rvm use 2.0.0@global --default
# for chinese user, if you have a wonderful speed ignore this part
# to have a faster download speed
# switch gem source to ruby.taobao.org
@ETiV
ETiV / nginx.conf
Created June 4, 2013 17:24 — forked from leon/nginx.conf
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@ETiV
ETiV / random_string.js
Created June 5, 2013 09:44
JavaScript Generate Random String
// get random string by length `len`
function _getRandomString(len) {
len = len || 32;
var $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYAabcdefghijklmnopqrstuvwxyz0123456789_'; // string set
var maxPos = $chars.length;
var pwd = '';
for (i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
@ETiV
ETiV / LiveEdit-Enabler-for-JetBrains-IDEs.md
Last active December 18, 2015 16:29
JetBrains IDEs (IntelliJ/WebStorm/PySharm etc.) LiveEdit Enabler. Fix Port "63342" Listening Issue.

Example environment is on Windows. You may need to fix paths to fit your operating system.

  1. Open file <WebStorm_Installed_Dir>/bin/WebStorm.exe.vmoptions
  2. Add one line, here I'm using port 53342, you may choose any other ports you like, but shouldn't higher than 62000, that's the reason why the origin LiveEdit can't be used:
-Drpc.port=53342
  1. Restart the IDE. Configure the Chrome JB Plugin, change the port you've chosen.
  2. If that port is not using by any other applications, the Chrome JB plugin can be use now.