Skip to content

Instantly share code, notes, and snippets.

View jyungtong's full-sized avatar

jin yung jyungtong

  • Kuala Lumpur, Malaysia
View GitHub Profile
@jyungtong
jyungtong / coc-settings.json
Last active January 5, 2024 13:52
nvim config
{
"coc.preferences.jumpCommand": "tabe",
"eslint.executeAutofix": false,
"eslint.autoFixOnSave": false,
"snippets.extends": {
"typescript": ["javascript", "javascript-jasmine-arrow"]
},
"suggest.noselect": true
}
@jyungtong
jyungtong / .surfingkeys.js
Last active January 11, 2022 07:09
surfingkeys settings
const { map, unmap, mapkey, iunmap } = api;
settings.smoothScroll = false;
map('J', 'E');
map('K', 'R');
map('{', '<<');
map('}', '>>');
unmap('<Alt-p>');
# Insert your preferred key mappings here.
map s scrollPageUp
unmap f
map ff LinkHints.activateMode
unmap F
map fF LinkHints.activateModeToOpenInNewTab
unmap gi
map fi focusInput
unmap <a-p>
map p togglePinTab
@jyungtong
jyungtong / refresh-credentials.sh
Created March 17, 2018 07:41
auto refresh credentials for multiple server nodes
#!/bin/bash
DOCKER_AUTH=$(aws ecr get-login --no-include-email --region ap-southeast-1)
servers=(server1.app server2.app server3.app)
for server in ${servers[*]}
do
ssh -o "StrictHostKeyChecking no" root@$server "eval \"$DOCKER_AUTH\""
done
@jyungtong
jyungtong / run.sh
Created March 10, 2018 06:19
ss server
# ss-go
docker run -dt --name ss -p 6443:6443 mritd/shadowsocks -s "-s 0.0.0.0 -p 6443 -m aes-128-cfb -k SUPER_SECRET_PASSWORD --fast-open"
# ssr
docker run -d --name ssr-server --restart always -p 51348:51348 breakwa11/shadowsocksr
@jyungtong
jyungtong / mongodb.js
Created December 7, 2017 11:23
mongodb aggregation
// analytics_start_date:1509465600000
// analytics_end_date:1511971200000
db.orders.aggregate([
{
$match: {
// 'user_id': {
// $in: [
// '1d63afb0-a40a-11e7-822a-3ba2e980456e',
// 'd6053b60-97a3-11e7-b104-4b6408cb9132'
@jyungtong
jyungtong / config.js
Created November 20, 2017 07:14
aws config
const AWS = require('aws-sdk')
const sns = new AWS.SNS({
accessKeyId: '',
secretAccessKey: 'SECRET',
region: 'ap-southeast-1'
})
@jyungtong
jyungtong / mongoexport.sh
Last active January 29, 2018 04:41
Mongodb backup/restore/export
#!/bin/bash
mkdir ./sms
chmod 777 -R ./sms
docker run --rm -it -v `pwd`/sms:/sms mongo mongoexport -h 10.99.0.15 -d db-prod -c users -f contact_number -o list.json
mongorestore -h localhost -d {db_name} /backup/{db_name}
@jyungtong
jyungtong / docker-compose.yaml
Last active October 18, 2017 04:34
kong api gateway
version: '3'
services:
kong-db:
image: postgres:latest
environment:
- POSTGRES_USER=kong
- POSTGRES_DB=kong
volumes:
- ./kong-data:/var/lib/postgresql/data
@jyungtong
jyungtong / query.js
Last active October 13, 2017 03:50
mongodb query scripts
// reset all notifications
// db.lists.updateMany({}, { $set: { notifications: [] } })
var q1 = {
codes: '5238',
'notifications.code': {
'$ne': '5238'
}
}