Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / sslvpn.sh
Last active October 24, 2018 13:39
Pulse Secure Client Wrapper for Ubuntu (for Pulse-Secure-8.2R5) with simple usename/hostname cache
#!/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 / router.sh
Last active October 25, 2018 07:43
A helper for simplifying and remembering the add/route default gateway commands
#!/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 / XMind.desktop
Last active October 26, 2018 01:53
XMind-8 For Ubuntu 18.04
[Desktop Entry]
Name=XMind
Exec=/opt/xmind-8/XMind_amd64/XMind.sh
Type=Application
Terminal=false
Comment=XMind 8
Icon=/opt/xmind-8/XMind_amd64/XMind.ico
@rightson
rightson / roto3t.desktop
Created October 26, 2018 01:55
Roto3t desktop file for Ubuntu
[Desktop Entry]
Name=Roto3T
Exec=/opt/robo3t/bin/robo3t
Type=Application
Terminal=false
Comment=Robo3T
Icon=/opt/robo3t/bin/robo3t.png
@rightson
rightson / vbox-manage-discovery-guest-ip.sh
Last active October 29, 2018 15:17
Discovering Guest IP Address of VirtualBox
# reference: https://forums.virtualbox.org/viewtopic.php?f=7&t=29861
# get guest's IP address
guest_name=full-name-of-vbox
VBoxManage --nologo guestproperty get "${guest_name}" /VirtualBox/GuestInfo/Net/0/V4/IP
VBoxManage --nologo guestproperty get "${guest_name}" /VirtualBox/GuestInfo/Net/1/V4/IP
@rightson
rightson / rdp-example-usage.sh
Last active March 29, 2019 03:35
A naive wrapper for xfreerdp v2.0.0 (with an example usage)
#!/bin/bash
# Assuming this script is put in the same folder with rdp.sh
host=<your-host-address>
user=<your-account>
password=<your-pwd>
cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $cwd/rdp.sh
@rightson
rightson / Makefile
Last active February 16, 2019 08:11
Naive Makefile for compiling and running single c++ source file
TARGET := $(MAKECMDGOALS)
CXX_FLAGS := -std=c++11
$(TARGET): force-clean
g++ $(TARGET).cpp $(CXX_FLAGS) -o $(TARGET) && ./$(TARGET)
force-clean:
\rm -f $(TARGET)