Skip to content

Instantly share code, notes, and snippets.

View shawjia's full-sized avatar
🎯
Focusing

shawjia

🎯
Focusing
  • Shenzhen, China
View GitHub Profile
@shawjia
shawjia / backup.sh
Created April 10, 2019 06:30
macOS backup
BACKUP_DIR=~/Documents/settings/app-list/`hostname`
mkdir -p $BACKUP_DIR
cd $BACKUP_DIR
# backup brew
/usr/local/bin/brew bundle dump --force
# back node packages
source ~/.nvm/nvm.sh
@shawjia
shawjia / sitemap.json
Last active December 26, 2018 09:14
[web scraper sitemap for 新浪微博] 新浪微博爬虫 #webscraper #weibo
{"_id":"weibo-jiangnan","startUrl":["https://weibo.cn/u/2189910831"],"selectors":[{"id":"weibo","type":"SelectorElement","parentSelectors":["_root","next-page"],"selector":"div.c[id^=M]","multiple":true,"delay":0},{"id":"time","type":"SelectorText","parentSelectors":["weibo"],"selector":"span.ct","multiple":false,"regex":"([\\s\\S]+)(?=来自)(?=[\\s\\S]+)","delay":0},{"id":"msg","type":"SelectorText","parentSelectors":["weibo"],"selector":"_parent_","multiple":false,"regex":"","delay":0},{"id":"img","type":"SelectorImage","parentSelectors":["weibo"],"selector":"img.ib","multiple":false,"delay":0},{"id":"comment","type":"SelectorElementAttribute","parentSelectors":["weibo"],"selector":"a.cc","multiple":false,"extractAttribute":"href","delay":0},{"id":"next-page","type":"SelectorLink","parentSelectors":["_root","next-page"],"selector":"div.pa a:nth-of-type(1)","multiple":false,"delay":0}]}
@shawjia
shawjia / github-follow-all.js
Created December 24, 2018 03:29
batch follow
document.querySelectorAll('div.col-9 span.follow button')
.forEach((ele, i) => {
setTimeout(() => {
console.log(ele.click(), ele.title);
}, i * 100);
});
@shawjia
shawjia / git.io.sh
Created November 5, 2018 05:07
using curl to create git.io url
curl https://git.io/ -i -F "url=https://shawjia.github.io/vkxd/2018/11/05-fund" -F "code=start-fund"
# you get https://git.io/start-fund
@shawjia
shawjia / qieman-sign.md
Created October 30, 2018 06:47
且慢 接口签名方式
const ts = Date.now();
const sign = ts + sha256(Math.floor(1.01 * ts).toString()).toUpperCase().substring(0, 32);
@shawjia
shawjia / png-to-gif.sh
Created October 30, 2018 03:28
convert png to gif by using macOS's builtin sips
sips -s format gif doge.png --out doge.gif
@shawjia
shawjia / gist:71e4b29ae51c6519e5ab
Last active August 29, 2015 14:25 — forked from mgmilcher/gist:5eaed7714d031a12ed97
Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X

This is my take on how to get up and running with NGINX, PHP-FPM, MySQL and phpMyAdmin on OSX Yosemite.

This article is adapted from the original by Jonas Friedmann. Who I just discovered is from Würzburg in Germany. A stonesthrow from where I was born ;)

Xcode

Make sure you have the latest version of XCode installed. Available from the Mac App Store.

Install the Xcode Command Line Tools:

xcode-select --install

@shawjia
shawjia / learn-objc.md
Last active December 11, 2015 03:38
Notes on Learning Objective-C

参考文档

Category (类别)

Category extends class functionality without subclassing.

#import "ClassName.h"
@shawjia
shawjia / app.coffee
Created December 16, 2012 07:41
load module written in CoffeeScript
###
load from CoffeeScript
just load, nothing else
###
{hello} = require './test'
hello()
@shawjia
shawjia / forever-CoffeeScript-App.md
Created December 16, 2012 06:36
use forever to deploy Node.js App which is written in CoffeeScript

Solutions

it's quite simple.

forever start -c coffee app.coffee