Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott Chen rightson

View GitHub Profile
@rightson
rightson / router.sh
Last active Oct 25, 2018
A helper for simplifying and remembering the add/route default gateway commands
View router.sh
#!/bin/bash
CONFIG=~/.route.conf
function usage() {
echo -e "Usage: `basename $0` <options>\noptions:"
grep "^function" $0 | sed 's/function/ /g' | sed 's/[{()]//g'
}
function list() {
@rightson
rightson / sslvpn.sh
Last active Oct 24, 2018
Pulse Secure Client Wrapper for Ubuntu (for Pulse-Secure-8.2R5) with simple usename/hostname cache
View sslvpn.sh
#!/bin/bash
CLIENT=/usr/local/pulse/PulseClient.sh
CONFIG=~/.sslvpn.conf
function usage() {
echo -e "Usage: `basename $0` <options>\noptions:"
grep "^function" $0 | sed 's/function/ /g' | sed 's/[{()]//g'
}
@rightson
rightson / vue.config.js
Created Aug 7, 2018
vuel-cli 3.x proxy setting (different from 2.x's proxyTable setting)
View vue.config.js
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8000/api',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/api': ''
}
@rightson
rightson / register-gitea-as-service.bat
Last active Jul 10, 2018
Register gitea as a windows service
View register-gitea-as-service.bat
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
@rightson
rightson / ubuntu-mate-18.04-provisioning.sh
Last active Jul 10, 2018
My quick provisioning script for Ubuntu MATE 18.04
View ubuntu-mate-18.04-provisioning.sh
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
@elit8888
elit8888 / res_adjust.md
Last active Dec 12, 2017
Use keyboard shortcut to adjust resolution higher or lower in MacOS
View res_adjust.md

Resolution Adjustment Shortcut Setup

This note illustrates how to adjust resolution using keyboard shorcut using built-in app automator. After setting up, I can use two actions:

  • Switch to Highest resolution
  • Switch to Default resolution

I'm new to apple script, so the rule is very simple.

References:

@brianboyko
brianboyko / README.md
Last active Jul 23, 2020
VueJS Best Practices Guide
View README.md

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.

View ovs
#!/bin/sh
ovs_dir_conf="/usr/local/etc/openvswitch"
ovs_file_conf_db="${ovs_dir_conf}/conf.db"
ovs_file_schema="vswitchd/vswitch.ovsschema"
#ovs_file_schema="${ovs_dir_conf}/vswitch.ovsschema"
ovs_file_var="/usr/local/var/run/openvswitch"
start()
@vlucas
vlucas / encryption.js
Last active Aug 7, 2020
Stronger Encryption and Decryption in Node.js
View encryption.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
View center_active_window.py
#!/usr/bin/env python3
# Author: Serg Kolo
# Date: Oct 3rd, 2016
# Description: Script for aligning the center of
# user's active window with the center of the monitor
# Tested on: Ubuntu 16.04
# Written for: http://askubuntu.com/q/832720/295286
from __future__ import print_function
import gi
You can’t perform that action at this time.