Skip to content

Instantly share code, notes, and snippets.

View bnguyensn's full-sized avatar
Hacking away...

Binh Nguyen bnguyensn

Hacking away...
View GitHub Profile
git config --global alias.cleanup-local-dry '!f() { \
current=$(git symbolic-ref --short HEAD); \
git branch --format="%(refname:short)" | \
grep -E "^(feature/|fix/|bugfix/)" | \
grep -v "^$current\$" | \
xargs -r -n 1 echo "Would delete branch:"; \
}; f'
git fetch -p
for branch in $(git branch --format='%(refname:short)' | grep -v 'develop'); do
remote_branch=$(git for-each-ref --format='%(upstream:short)' refs/heads/$branch)
if [ -n "$remote_branch" ] && ! git show-ref --quiet "refs/remotes/$remote_branch"; then
git branch -d "$branch"
fi
done
@bnguyensn
bnguyensn / dh-99-example-gha.yaml
Created March 30, 2021 15:08
DH-99 example GitHub action
# This job is right below "publish_results"
comment_on_jira:
name: "Comment on Jira"
if: github.event.action == 'opened'
needs: [linting, unit_test, end_to_end_test, deploy_pr_frontend, deploy_storybook, plan_staging, plan_prod]
runs-on: ubuntu-latest
steps:
- name: "Login to JIRA"
@bnguyensn
bnguyensn / git-alias.md
Created March 17, 2021 13:32
git aliases

Contains useful git aliases for .gitconfig

[alias]
	st = status
	
	aa = add .
	ca = "!git add . && git commit"
	c = commit
	cm = commit -m
@bnguyensn
bnguyensn / git-tag-npm-version.md
Last active February 27, 2021 11:25
git tag / npm version

git tag

This gist describes tagging in git

Annotated tags

Create a new annotated tag identified with "v1.0.0":

$ git tag -a v1.0.0
@bnguyensn
bnguyensn / youtube-to-mp3.md
Created August 2, 2020 22:11
Youtube videos -> .mp3

Convert Youtube videos to .mp3 with VLC

Here are the steps:

  1. Copy the Youtube video's link into VLC's "Open Network Stream" option (Media > Open Network Stream)
  2. Click Tools > Media Information
  3. Copy the "Location" text at the bottom and paste it into the browser
  4. Right-click the video in the browser and select "Save video as"
  5. Convert the downloaded video into .mp3 using FFmpeg: link
@bnguyensn
bnguyensn / deno.md
Last active June 6, 2020 10:11
Deno Land

Deno

Deno is the new and hip Node.js.

CLI

deno run <xxx>: execute a script

deno test <xxx>: execute a test script

@bnguyensn
bnguyensn / .gitconfig
Created May 11, 2020 08:28
Example .gitconfig
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[user]
name = Binh Nguyen
[user]
email = [email protected]
[winUpdater]
recentlySeenVersion = 2.25.0.windows.1
@bnguyensn
bnguyensn / simple-git.md
Last active July 8, 2020 21:08
Simple git

1. START

1. Update master branch

Make sure all changes have been saved before this either per section 2.2 or 3.2 below.

git checkout master
git pull
@bnguyensn
bnguyensn / extensions.json
Last active April 22, 2020 18:36
Visual Studio Code Settings Sync Gist
[
{
"metadata": {
"id": "464f4ac7-af65-4aa9-9907-4ba7fa419085",
"publisherId": "bungcip.better-toml",
"publisherDisplayName": "bungcip"
},
"name": "better-toml",
"publisher": "bungcip",
"version": "0.3.2"