Skip to content

Instantly share code, notes, and snippets.

View jiang-wei's full-sized avatar
🏠
Working from home

Jiang Wei jiang-wei

🏠
Working from home
  • Toronto, Canada
View GitHub Profile
@jiang-wei
jiang-wei / sync chrome bookmark.md
Last active September 29, 2016 16:01
使用网盘同步 chrome 书签

chrome 书签经常因为各种原因无法同步。 这里考虑使用网盘,如微软的 OneDrive 同步 chrome 的书签文件。 书签文件在

"C:\Users\JiangWei\AppData\Local\Google\Chrome\User Data\Profile 2\Bookmarks"

用管理员命令行运行 mklink 命令,创建一个硬连接

C:\Users\JiangWei\OneDrive\bookmarks>mklink /H bookmarks "C:\Users\JiangWei\AppData\Local\Google\Chrome\User Data\Profile 2\Bookmarks"
@jiang-wei
jiang-wei / gist:82b4f923b5f49516d2e3cc866db75c90
Created January 18, 2018 18:25
有趣的 python module
用于生成测试假数据的 module
faker 可用于产生虚拟的名字、地址等信息
用于生成进度条的 module
tqdm 在命令行上显示进度条
用于表格化输出的 module
tabulate
@jiang-wei
jiang-wei / docker_mvnw.sh
Last active October 22, 2019 18:25
run mvn in docker container
#!/bin/bash
set -x
MVN_CMD=${1:-"./mvnw clean package -DskipTests=true -Pprod"}
docker run -it -v `pwd`:/mnt/ -v ~/.m2:/root/.m2 --rm maven /bin/bash -c "cd /mnt && $MVN_CMD"
#!/bin/bash
# https://ben.lobaugh.net/blog/201616/cleanup-and-remove-all-merged-local-and-remote-git-branches
for remote in `git branch -r `; do git branch --track $remote; done
git branch --merged master | grep -v master | cut -d/ -f2- | xargs -n 1 git push --delete origin
git branch --merged master | grep -v master | xargs -n 1 git branch -d
@jiang-wei
jiang-wei / git-tag-delete-local-and-remote.sh
Created June 14, 2018 20:39 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@jiang-wei
jiang-wei / gcloud connect to alternative PGSQL
Last active June 29, 2018 20:47
gcloud conntct to alternative pg database
PGDATABASE=mydb gcloud sql connect myinstance
import hudson.model.*
def q = Jenkins.instance.queue
q.items.each {
if (it =~ /deploy-to/) {
q.cancel(it.task)
}
}
@jiang-wei
jiang-wei / kubectl update secret.sh
Created June 29, 2018 20:46
kubectl update secret
kubectl create secret generic production-tls --from-file=./tls.key --from-file=./tls.crt --dry-run -o yaml | kubectl apply -f -
kubectl create secret tls production-tls --key=./tls.key --cert=./tls.crt --dry-run -o yaml | kubectl apply -f -
@jiang-wei
jiang-wei / WebDriverJs-example.js
Created August 17, 2018 15:45
WebDriverJs example
const {Builder, By, until} = require('selenium-webdriver');
let driver = new Builder()
.forBrowser('firefox')
.build();
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnK')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
@jiang-wei
jiang-wei / selenium-example.side
Created August 17, 2018 16:37
selenium example
{
"id": "f0310b9c-3ed2-4b43-88f2-cf7fa1f6867a",
"name": "open google.ca",
"url": "https://www.google.ca",
"tests": [{
"id": "e9662b73-483b-4db9-9b84-b9a9652145b2",
"name": "Untitled",
"commands": [{
"id": "a2fffec4-2464-4d1b-a767-595da262e200",
"comment": "",