Skip to content

Instantly share code, notes, and snippets.

View ngshiheng's full-sized avatar

Jerry Ng ngshiheng

View GitHub Profile
@jonlabelle
jonlabelle / compare_versions.sh
Last active October 6, 2023 19:02
Compare Semver Versions in Bash
#!/usr/bin/env bash
#
# Performs a simple semver comparison of the two arguments.
#
# Original: https://github.com/mritd/shell_scripts/blob/master/version.sh
# Snippet: https://jonlabelle.com/snippets/view/shell/compare-semver-versions-in-bash
# Gist: https://gist.github.com/jonlabelle/6691d740f404b9736116c22195a8d706
#
@sdesalas
sdesalas / Async.gs
Last active April 29, 2025 01:24
Asynchronous execution for Google App Scripts (gas)
/*
* Async.gs
*
* Manages asyncronous execution via time-based triggers.
*
* Note that execution normally takes 30-60s due to scheduling of the trigger.
*
* @see https://developers.google.com/apps-script/reference/script/clock-trigger-builder.html
*/
@ngshiheng
ngshiheng / cloudSettings
Last active November 25, 2021 04:21
VSCode cloudSettings (Jerry)
{"lastUpload":"2021-11-15T07:51:35.825Z","extensionVersion":"v3.4.3"}
@crucialfelix
crucialfelix / graphql_auth.py
Created August 4, 2017 19:03
django-graphene auth decorator
from decorator import decorator
def _check_auth(args, pred):
_, _, context, _ = args
if not pred(context):
raise Exception("Unauthorized")
@decorator
def is_user(fn, *args, **kwargs):
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 29, 2025 08:17
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@mpneuried
mpneuried / Makefile
Last active April 29, 2025 08:09
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@aGHz
aGHz / google-sheets-dataclip-autoupdate.md
Last active October 6, 2021 18:24
Auto-updating importData of Heroku Dataclips in Google Sheets

Dataclips URLs

Dataclips has a reliable way to construct the URL of a clip's CSV version:

https://dataclips.heroku.com/<hash>-<description>.csv

Thankfully the description is irrelevant, so we can just get the hash from the web interface (looks like aujqawhjdmlbbwrqxutcpzzqyika) and add -1 at the end. Every time we change the

@joepie91
joepie91 / vpn.md
Last active April 25, 2025 13:58
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)