Skip to content

Instantly share code, notes, and snippets.

View samkahchiin's full-sized avatar
🎯
Focusing

Sam Kah Chiin samkahchiin

🎯
Focusing
View GitHub Profile
@samkahchiin
samkahchiin / closeTabsToRight.md
Last active September 12, 2021 09:11
Apple Script: Close Tabs To Right (Google Chrome

Questions:

  • Cannot work when I do close tabs whose id is not in closeTabList => Will get can’t make {241, 246} into type specifier error
  • Cannot get the index of tab (therefore I cannot get the current Tab's index and filter those that is on the right)
@samkahchiin
samkahchiin / System Design.md
Created August 9, 2021 09:07 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)

Keybase proof

I hereby claim:

  • I am samkahchiin on github.
  • I am kcsam (https://keybase.io/kcsam) on keybase.
  • I have a public key ASDkWsrAyVDGFAyBRxvmCT7gzjje-LeZ6gXWHM9CYvUeNgo

To claim this, I am signing this object:

@samkahchiin
samkahchiin / keybindings.json
Last active July 13, 2020 10:47
Visual Studio Key Bindings
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+space",
"command": "editor.action.triggerSuggest",
"when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
},
{
"key": "ctrl+space",
"command": "-editor.action.triggerSuggest",
@samkahchiin
samkahchiin / alias.zsh
Last active June 29, 2020 12:43
Handy alis for git emoji
git-wip() {
git commit -S -s -m ":poop: - $(printf '%s ' "$@")"
}
git-finish() {
git commit -S -s -m ":sparkles: $(printf '%s ' "$@")"
}
git-ci-commit() {
git commit -S -s -m ":green_heart: $(printf '%s ' "$@")"
@samkahchiin
samkahchiin / signed-pgp-github.md
Last active June 29, 2020 12:11 — forked from TheCureliestWalk/signed-gpg-github.md
How to create GPG Signed key with Keybase on Github

Sign PGP Key on Github with Keybase

mrkdwn-pass

Set everything up

  • Linux Computer (Windows or MacOS is compatible but you need to install GIT manually)
  • You need to install Keybase, login or sign up one if you don't have.
  • Your basic skill with Git and Github:

You need to know that Linux are have a default software: gpg for sign the GPG key. but we are going to use Keybase instead.

@samkahchiin
samkahchiin / remove-ds-store
Created May 25, 2020 01:56
Bash command that can remove all the DS_Store file
# specify a global exclusion list
git config --global core.excludesfile ~/.gitignore_global
# adding .DS_Store to that list
echo .DS_Store >> ~/.gitignore_global
@samkahchiin
samkahchiin / Google Form
Created April 17, 2020 05:26
Send email to Gmail after user submit a google form responses
function onFormSubmit(e) {
var sheet = SpreadsheetApp.getActiveSheet();
var row = sheet.getLastRow();
var receiptId = row - 1;
sheet.getRange(row,6).setValue(receiptId);
var user = {receiptId: receiptId, name: e.namedValues['Name'][0], email: e.namedValues['Email'][0], amount: e.namedValues["Donation Amount"][0]};
sendDoc_(user);
}
function sendDoc_(user) {
@samkahchiin
samkahchiin / dharma-audio.rb
Created November 4, 2019 12:59
First attempt to use google speech
require "google/cloud/storage"
require "google/cloud/speech"
# puts "Your project id?"
# project_id = gets.chomp
#
# puts "Your bucket name?"
# bucket_name = gets.chomp
puts "File name?"