Skip to content

Instantly share code, notes, and snippets.

@wohugb
wohugb / index.html
Last active April 5, 2022 02:36 — forked from Globik/index.html
Websocket multi room based on ws.js
<html>
<body>
<h4>websocket</h4>
<h5>Group: <span id="group">darwin</span></h5>
<!-- a hardoced group name -->
<button onclick="bjoin();">join group</button><br />
<input id="text" type="text" />
<span id="out"></span>
<script>
var group = document.getElementById("group").textContent;
@wohugb
wohugb / rst_to_md.sh
Created January 26, 2018 13:35 — forked from zaiste/rst_to_md.sh
Convert RST to Markdown using Pandoc
FILES=*.rst
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.md"
`pandoc $f -f rst -t markdown -o $filename.md`
done
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@wohugb
wohugb / sample-nginx.conf
Created May 3, 2017 08:19 — forked from cjus/sample-nginx.conf
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
@wohugb
wohugb / .npmrc
Last active February 3, 2022 06:25 — forked from tonyc726/.npmrc
河蟹加速npm/yarn的资源安装升级速度
registry="https://registry.npmmirror.com"
disturl="https://npmmirror.com/dist"
nvm_nodejs_org_mirror="https://npmmirror.com/mirrors/node"
nodejs_org_mirror="https://npmmirror.com/mirrors/node"
sass_binary_site="https://npmmirror.com/mirrors/node-sass"
electron_mirror="https://npmmirror.com/mirrors/electron/"
SQLITE3_BINARY_SITE="https://npmmirror.com/mirrors/sqlite3"
profiler_binary_host_mirror="https://npmmirror.com/mirrors/node-inspector/"
node_inspector_cdnurl="https://npmmirror.com/mirrors/node-inspector"
selenium_cdnurl="https://npmmirror.com/mirrors/selenium"
@wohugb
wohugb / gist:5370983e77729cfedc472a5fc752ac8b
Created May 10, 2016 09:39 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@wohugb
wohugb / angular.filters.nl2br.js
Created October 25, 2015 16:19 — forked from naoyeye/angular.filters.nl2br.js
angular nl2br filter
/*
# Usage in html template:
"xxx | nl2br"
<div ng-bind-html=" YourString | nl2br "></div>
or:

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

function encrypt(text,key){
var cipher = crypto.createCipher('aes-256-cbc',key)
var crypted = cipher.update(text,'utf8','hex')
crypted += cipher.final('hex');
return crypted;
}
function decrypt(text,key){
var decipher = crypto.createDecipher('aes-256-cbc',key)
var dec = decipher.update(text,'hex','utf8')