Skip to content

Instantly share code, notes, and snippets.

View xuyuji9000's full-sized avatar

Karl Xu xuyuji9000

  • Shanghai, China
View GitHub Profile
#!/bin/bash
cd ~
git clone https://github.com/xuyuji9000/dotfile.git .dotfile
source ~/.dotfile/setup.sh
vim
@xuyuji9000
xuyuji9000 / mysql-full-backup.sh
Last active August 11, 2017 08:14
Make a full backup of a specific database in mysql
#!/bin/bash
DATABASE="forward"
mysqldump -u mysqlusernamehere -pmysqlpasswordhere $DATABASE > /mnt/mysql/full/$(date +"%d-%b-%Y")_$(echo $DATABASE).sql
@xuyuji9000
xuyuji9000 / remove-expired-files.sh
Last active August 11, 2017 11:06
Remove files with modification time more than 30 days ago.
#!/bin/bash
find ./ -mindepth 1 -mtime +30 -exec rm '{}' \;
#!/bin/bash
# install docker
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
@xuyuji9000
xuyuji9000 / ubuntu-1604-install-redis.sh
Created August 10, 2017 03:43
Install Redis on Ubuntu 16.04 LTS
#!/bin/bash
sudo apt-get update
sudo apt-get install redis-server
#!/bin/bash
cd ~
git clone https://github.com/xuyuji9000/dotfile.git .dotfile
source ~/.dotfile/setup.sh
vim
{
"ResourceRecords": [
{
"Value": "13.124.193.69"
}
],
"Type": "A",
"Name": "swarm.yogiman.cn.",
"TTL": 60
},
#!/bin/bash
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@xuyuji9000
xuyuji9000 / encoding_conv.js
Created May 26, 2017 02:19
JS string encoding convert, with iconv-lite and jschardet.
const reader = new FileReader()
const file = this.uploadInput.files[0]
let self = this
reader.onload = function()
{
let target_data = ''
const data_info = jschardet.detect(reader.result)
if('ascii'==data_info.encoding && data_info.confidence > 0)
target_data = this.result
else
let _ = require('lodash')
let thing = [
{"a": 123},
{"a": 456},
{"abc": 6789},
]
console.log(typeof(thing))
let result = _.filter(thing, function(element){