Skip to content

Instantly share code, notes, and snippets.

Scott Chen rightson

Block or report user

Report or block rightson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rightson
rightson / Makefile
Created Jul 31, 2019
LaTex build tips
View Makefile
PAPER := main
# remember to add \usepackage[dvipdfm]{graphicx} to your $(PAPER).tex
pdf:
latex $(PAPER).tex
dvipdfm $(PAPER).dvi
.PHONY: pdf
@rightson
rightson / Makefile
Last active Jul 11, 2019
My Makefile to build PDF from LaTex
View Makefile
SOURCE := paper.tex
mk:
latexmk -cd -f -pdf -interaction=nonstopmode -synctex=1 $(SOURCE)
pdf:
pdflatex $(SOURCE)
clean:
$(call clean)
@rightson
rightson / jupyter-custom.js
Created Jun 18, 2019
Custom scripts for supporting sublime keymap
View jupyter-custom.js
// .jupyter/custom/custom.js
require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
function(sublime_keymap, cell, IPython) {
cell.Cell.options_default.cm_config.keyMap = 'sublime';
cell.Cell.options_default.cm_config.extraKeys['Ctrl-Enter'] = function() { console.log('ctrl-enter') };
var cells = IPython.notebook.get_cells();
for (var cl = 0; cl < cells.length; cl++) {
cells[cl].code_mirror.setOption('extraKeys', {
'Ctrl-Enter': function () {}
@rightson
rightson / let-robo3t-scale-in-hidpi.sh
Last active May 24, 2019
The trick to scale Robo3t in HiDPI resolution
View let-robo3t-scale-in-hidpi.sh
export QT_SCALE_FACTOR=2
export QT_AUTO_SCREEN_SCALE_FACTOR=0
cat << EOF > /dev/null
Below is an example of *.desktop file (Ubuntu 16.04)
[Desktop Entry]
Name=Roto3T
Exec=env QT_SCALE_FACTOR=2 QT_AUTO_SCREEN_SCALE_FACTOR=0 /opt/robo3t/bin/robo3t
@rightson
rightson / Makefile
Last active Feb 16, 2019
Naive Makefile for compiling and running single c++ source file
View Makefile
TARGET := $(MAKECMDGOALS)
CXX_FLAGS := -std=c++11
$(TARGET): force-clean
g++ $(TARGET).cpp $(CXX_FLAGS) -o $(TARGET) && ./$(TARGET)
force-clean:
\rm -f $(TARGET)
@rightson
rightson / rdp-example-usage.sh
Last active Mar 29, 2019
A naive wrapper for xfreerdp v2.0.0 (with an example usage)
View rdp-example-usage.sh
#!/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 / vbox-manage-discovery-guest-ip.sh
Last active Oct 29, 2018
Discovering Guest IP Address of VirtualBox
View vbox-manage-discovery-guest-ip.sh
# 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 / roto3t.desktop
Created Oct 26, 2018
Roto3t desktop file for Ubuntu
View roto3t.desktop
[Desktop Entry]
Name=Roto3T
Exec=/opt/robo3t/bin/robo3t
Type=Application
Terminal=false
Comment=Robo3T
Icon=/opt/robo3t/bin/robo3t.png
@rightson
rightson / XMind.desktop
Last active Oct 26, 2018
XMind-8 For Ubuntu 18.04
View XMind.desktop
[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 / 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() {
You can’t perform that action at this time.