Skip to content

Instantly share code, notes, and snippets.

View commands-fo- easystroke.sh
# Minimize current window
xdotool windowminimize $(xdotool getactivewindow)
# Make current window always on top
wmctrl -r :ACTIVE: -b toggle,above
# Undo aways-on-top window
wmctrl -r :ACTIVE: -b remove,above
@rightson
rightson / OpenWithSublimeText3-Full.bat
Created May 23, 2021
Open With Sublime Text 3 Full Version
View OpenWithSublimeText3-Full.bat
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@rightson
rightson / grep_function_names.sh
Created Jan 9, 2021
A function to grep bash function name declared as "function $name () {" pattern
View grep_function_names.sh
grep_function_names () {
if [ -e "$1" ]; then
grep -E '^function' $1| awk '{print $2}' | sed -r 's/\(|\)|\{|\}//g'
fi
}
@rightson
rightson / PulseClient_x86_64.sh
Created Dec 20, 2020
PulseClient_x86_64.sh for Ubuntu 20.04
View PulseClient_x86_64.sh
#!/bin/bash
# Copyright (c) 2019-2020 by Pulse Secure, LLC. All rights reserved
HOMEDIR=$HOME
INSTALLDIR=/usr/local/pulse
PULSEDIR=$HOME/.pulse_secure/pulse
PULSECERTDIR=$PULSEDIR/certificates
SVCNAME=pulsesvc
UTILNAME=pulseutil
View ipset-blacklist
Name: blacklist
Type: hash:net
Revision: 6
Header: family inet hashsize 2048 maxelem 65536
Size in memory: 132248
References: 0
Number of entries: 4769
Members:
1.203.115.64
1.213.195.154
@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)