Skip to content

Instantly share code, notes, and snippets.

View alwinw's full-sized avatar
✈️
Navigating the changing skies

Alwin Wang alwinw

✈️
Navigating the changing skies
View GitHub Profile
@alwinw
alwinw / contribution-guide.md
Last active February 18, 2024 07:01
Contribution Guide with Commitizen and Poetry

Contribution Guide with Commitizen and Poetry

Requirements

  • Ensure python >= 3.8 with python --version. If required, upgrade python.
  • Ensure pip >= 22.0 for editable installation of pyproject.toml
  • Install poetry here
  • Install commitzen here

Environment

@alwinw
alwinw / r-setup.sh
Last active January 6, 2023 05:27
Getting up and running with R on Linux fast with a single script
# Configuring R for Package Developers on Linux
# Assumes you are using a Ubuntu-based distro
# Tested and working on Pop!_OS 22.04 LTS in 2023
# 1. System Requirements
sudo apt install -y build-essential
# 2. Install R
sudo apt update
sudo apt install -y r-base r-base-dev
@alwinw
alwinw / sync.sh
Last active September 1, 2022 00:08
Sync Foam Notes using Timestamp for Git Commit Message
#!/bin/bash
git pull
git add --all
git commit -asm "`date +'%a %d %b %Y %H:%M:%S'`"
git push
@alwinw
alwinw / 0_for-loops-R.R
Last active May 2, 2022 05:07
R for loops
library(microbenchmark)
library(data.table)
library(reshape2)
library(Rcpp)
library(dplyr)
library(ggplot2)
theme_set(theme_bw())
#--- Data ----
set.seed(1)
@alwinw
alwinw / branch-naming.md
Last active October 7, 2021 00:37
Git Branch Naming Conventions

Branch Naming

Summary

  • feat- - Development work on a new feature. Typ merged into a rc branch
  • doc- - Documentation of project, not code comments. Typ merged into a rc branch
  • fix-14- - Fix of a bug, include the issue number if possible. Typ merged into a rc branch
  • rc0.0.0 - Release candidate for a stable point and is ready to be released. May have an open draft pull request
  • main - Default branch. Has tags and releases with semantic versioning e.g. v0.9.1
@alwinw
alwinw / bootstrap_cmdline.py
Created May 17, 2020 09:08 — forked from elmotec/bootstrap_cmdline.py
Minimal python program with logging and argparse.
#!/usr/bin/env python
# encoding: utf-8
"""Minimal python commad line."""
import sys
import argparse
import logging
@alwinw
alwinw / README.md
Last active January 6, 2023 09:14
Ubuntu Minimum Lovable Environment
@alwinw
alwinw / docker_rm-containers-images.sh
Last active April 28, 2020 13:38
Remove unused docker containers and images
#!/bin/sh
FORCE_STOP=${FORCE_STOP:-"--force"}
docker ps -aq | xargs docker stop ${FORCE_STOP}
docker image prune -f
@alwinw
alwinw / git_delete-local-branches.sh
Created April 26, 2020 02:10
Git delete all local branches except master and current branch
#!/bin/sh
KEEP="master"
KEEP_LOCAL="${KEEP_LOCAL:-"true"}"
[ "$KEEP_LOCAL" = true ] && KEEP="${KEEP}\|\*"
echo "Deleting local branches"
git branch --list | grep -v "$KEEP" | xargs git branch -d
@alwinw
alwinw / git_sync-upstream.sh
Last active April 26, 2020 02:05
Git pull all branches from another remote and push them as their own group
#!/bin/sh
MIRROR_REPO=${MIRROR_REPO:-"origin"}
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-"upstream_remote"}
UPSTREAM_REMOTE_NAME=${UPSTREAM_REMOTE_NAME:-"upstream"}
UPSTREAM_REMOTE_URL=${UPSTREAM_REMOTE_URL:-"<alternate-remote.git>"}
echo "Pulling $UPSTREAM_REMOTE_URL"
git remote add "$UPSTREAM_REMOTE" "$UPSTREAM_REMOTE_URL"
git fetch "$UPSTREAM_REMOTE"