Skip to content

Instantly share code, notes, and snippets.

Avatar

Arthur Lui luiarthur

View GitHub Profile
@luiarthur
luiarthur / hello-server.R
Created Sep 16, 2020
Hello in R -- Server demo
View hello-server.R
for (i in 1:100) {
Sys.sleep(1)
current_time = format(Sys.time(),usetz = TRUE)
cat(current_time, "|", "Iteration", i, "|", "Hello!", "\n")
}
@luiarthur
luiarthur / GP_turing_example.ipynb
Last active Jul 16, 2020
Example of how to fit a full GP model in Turing.
View GP_turing_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luiarthur
luiarthur / install-tmux-without-root.sh
Created Jul 11, 2020
Install tmux without root permissions
View install-tmux-without-root.sh
# Installing TMUX without root permissions on LINUX machines is now as east 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
@luiarthur
luiarthur / stickbreak_img.py
Created Jul 10, 2020
Make image for stick-breaking process
View stickbreak_img.py
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(6)
n = 5
a = 3
lw = 10
stick_length = 1
@luiarthur
luiarthur / git-merge-squash.sh
Last active Jun 5, 2020
Merge and squash a git branch
View git-merge-squash.sh
# 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
View fosrk-sync.sh
# 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-rebase-tutorial
Last active May 11, 2020
git rebase (squashing several commits)
View git-rebase-tutorial
# 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
View git-revert-and-save-history
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
View git_branching.sh
# 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
View texWorkflow.md

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
You can’t perform that action at this time.