Skip to content

Instantly share code, notes, and snippets.

View bo-sfl's full-sized avatar
🏠
Working from home

Bo Li bo-sfl

🏠
Working from home
  • SFL Scientific
  • Santa Clara, CA
View GitHub Profile

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@bo-sfl
bo-sfl / gist:1de21519c15ebd2bfb8686e633a80195
Created July 28, 2020 05:28 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@bo-sfl
bo-sfl / gce-to-gcs-uploads.md
Created July 28, 2020 04:59 — forked from ryderdamen/gce-to-gcs-uploads.md
Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

I had a bit of trouble trying to configure permissions to upload files from my Google Compute Engine instance to my Google Cloud Storage bucket. The process isn't as intuitive as you think. There are a few permissions issues that need to be configured before this can happen. Here are the steps I took to get things working.

Let's say you want to upload yourfile.txt to a GCS bucket from your virtual machine. You can use the gsutil command line tool that comes installed on all GCE instances.

If you've never used the gcloud or gsutil command line tools on this machine before, you will need to initialize them with a service account.

@bo-sfl
bo-sfl / gist:1124466e871b8b886be30316ce353ad2
Created April 30, 2020 16:13
How do I delete all files smaller than a certain size in all subfolders?
find . -name "*.tif" -type 'f' -size -160k -delete

Run the command without -delete first to verify that the correct files are found.

Note the - before 160k. Just 160k means exactly 160 kilobytes. -160k means smaller than 160 kilobytes. +160k means larger than 160 kilobytes.

The -type 'f' forces the command to only act on files and skip directories. this would avoid errors if the path contains folders with names that match the pattern *.tif.

@bo-sfl
bo-sfl / automatic-version-numbers.md
Created April 21, 2020 06:07 — forked from sg-s/automatic-version-numbers.md
Automatic version numbers of your git repository using git hooks

Put this in a file called pre-commit in .git/hooks/

#!/bin/sh
# To enable this hook, rename this file to "pre-commit".

git log master --pretty=oneline | wc -l > build_number
git add build_number
@bo-sfl
bo-sfl / tmux-cheatsheet.markdown
Created October 21, 2019 12:53 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@bo-sfl
bo-sfl / gist:28d6e039ff1c764a29b7b5d5ddf034f7
Created October 17, 2019 18:18 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream