Skip to content

Instantly share code, notes, and snippets.

View luiarthur's full-sized avatar

Arthur Lui luiarthur

View GitHub Profile
@luiarthur
luiarthur / tmux_local_install.sh
Created September 25, 2015 16:18 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@luiarthur
luiarthur / Makefile
Created September 28, 2018 19:05
Makefile example for running multiple jobs
# RUN ALL THIS IN AN EMPTY DIR!
# Run in parallel
MAKEFLAGS += -j4
# Simulation variables.
MSG = "Hello"
PARAMS := 100 1000 10000
#PARAMS := $(shell seq 1 10) # or something like this for params = 1, 2, ..., 10
SIMS := $(addprefix sim, $(PARAMS))
@luiarthur
luiarthur / texWorkflow.md
Created October 1, 2018 23:18
My LaTeX workflow

My LaTeX Workflow

Option I (VS Code)

  • Use the VS Code editor
    • Install the LaTeX Workshop Editor from VS Code [Marketplace][1]
    • Install the listed requirements
    • Install the listed Spell checker
    • Install VIM plugin
    • Auto-build LaTeX pdf on save
  • View pdf in VS Code tab
# Simple Branching in Git / Github
# Reference: https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches
# Before creating a new branch, pull the changes from upstream.
# Your master needs to be up to date.
# Create new branch
git checkout -b myNewBranch
git checkout [revision] .
# where [revision] is the commit hash (for example: 12345678901234567890123456789012345678ab).
# Don't forget the . at the end, very important.
# See: https://stackoverflow.com/questions/2007662/rollback-to-an-old-git-commit-in-a-public-repo
# Other useful commands
# Show which files were changed
git log --raw
@luiarthur
luiarthur / git-rebase-tutorial
Last active May 11, 2020 19:05
git rebase (squashing several commits)
# How to squash several commits into one big commit
See this also: https://www.internalpointers.com/post/squash-commits-into-one-git
1. Inspect the previous commits to see where you want to place the last commit
```
git log --oneline
```
2. Rebase
# Go to master branch (if needed)
git checkout master
# Look around
git remote -v
# Add upstream repo of the fork (if needed)
git remote add upstream <ssh-or-https-url-to-original-repo>
# Look around again
@luiarthur
luiarthur / git-merge-squash.sh
Last active June 5, 2020 17:13
Merge and squash a git branch
# Say you are working on a branch called `my-branch`
# and you wish to now merge it into `master`, and
# squash all commits from `my-branch` into one commit.
# You can do the following:
git checkout master
git merge --squash my-branch
git commit
# You will then be placed in an editor with all your previous
@luiarthur
luiarthur / stickbreak_img.py
Created July 10, 2020 01:31
Make image for stick-breaking process
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(6)
n = 5
a = 3
lw = 10
stick_length = 1
@luiarthur
luiarthur / install-tmux-without-root.sh
Last active December 3, 2022 13:06
Install tmux without root permissions
# Installing TMUX without root permissions on LINUX machines is now as easy as this:
# Get the app image from tmux3 git repo.
wget https://github.com/tmux/tmux/releases/download/3.0a/tmux-3.0a-x86_64.AppImage
# Grant execute permissions.
chmod +x tmux-3.0a-x86_64.AppImage
# Move to ~/bin
mv tmux-3.0a-x86_64.AppImage ~/bin