Skip to content

Instantly share code, notes, and snippets.

@rightson
rightson / route-util.sh
Created August 14, 2018 11:20
A utility that can quickly set default gateway's metric to 0 or delete entire routing rule
#!/bin/bash
op=$1
iface=$2
gateway=$3
if [ -z "$op" ]; then
op=add
fi
if [ -z "$iface" ]; then
@rightson
rightson / vue.config.js
Created August 7, 2018 08:03
vuel-cli 3.x proxy setting (different from 2.x's proxyTable setting)
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8000/api',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/api': ''
}
@rightson
rightson / ubuntu-mate-18.04-provisioning.sh
Last active July 10, 2018 02:37
My quick provisioning script for Ubuntu MATE 18.04
echo 'Adding repository of sierra theme ...'
sudo add-apt-repository ppa:dyatlov-igor/sierra-theme -y
echo 'Adding repository of spotify ...'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0DF731E45CE24F27EEEB1450EFDC8610341D9410 931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
echo 'Updating apt ...'
sudo apt update
@rightson
rightson / register-gitea-as-service.bat
Last active July 10, 2018 02:36
Register gitea as a windows service
rem Register command
sc create Gitea start= auto binPath= ""D:\Applications\gitea\gitea.exe" web --config "D:\Applications\gitea\my-app.ini""
rem De-register command
sc delete Gitea
echo 'Updating apt ...'
sudo apt update
echo 'Installing minimal deps ...'
sudo apt install -y openssh-server git vim vim-gtk3 tmux tree gparted zsh-antigen terminator curl build-essential
echo 'Upgrading system ...'
sudo apt upgrade -y
echo 'Installing custom dev env ...'
@rightson
rightson / cloudSettings
Last active June 5, 2018 02:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-06-05T02:58:12.185Z","extensionVersion":"v2.9.2"}
@rightson
rightson / config.ini
Last active May 26, 2018 12:31
My terminator (1.91) setting
[global_config]
focus = mouse
title_inactive_bg_color = "#000000"
title_inactive_fg_color = "#2e3436"
title_transmit_bg_color = "#000000"
title_transmit_fg_color = "#ef2929"
[keybindings]
switch_to_tab_1 = <Alt>1
switch_to_tab_2 = <Alt>2
switch_to_tab_3 = <Alt>3
@rightson
rightson / code.sh
Created April 22, 2018 13:39
A shell script to invoke VS Code Insiders from command line (ubuntu)
#!/bin/bash
nohup /usr/share/code-insiders/code-insiders $* > /dev/null 2>&1 &
# rename `code.sh` to `code` and put it to some $PATH (e.g. /usr/local/bin/code)
@rightson
rightson / simple-server.py
Last active April 22, 2018 12:05
simple flask
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/store' , methods=['POST'])
def create_store():
print(request.data)
print(request.get_json())
return 'haha'
@rightson
rightson / main.c
Last active March 11, 2018 15:04
L073RZ-UART2 Example
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
** This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.