Skip to content

Instantly share code, notes, and snippets.

View ilovejs's full-sized avatar
🐡
mememe, hv a good fish !

Michael Zhuang ilovejs

🐡
mememe, hv a good fish !
  • Sydney
  • 14:05 (UTC +10:00)
View GitHub Profile
@ilovejs
ilovejs / .golangci.yml
Created December 13, 2022 02:09 — forked from maratori/.golangci.yml
Golden config for golangci-lint
# This code is licensed under the terms of the MIT license.
## Golden config for golangci-lint v1.50.1
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adopt and change it for your needs.
run:
# Timeout for analysis, e.g. 30s, 5m.
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@alexellis
alexellis / MULTIPASS_OPENFAAS.md
Last active December 5, 2022 03:39
Get k3s with OpenFaaS using k3sup and multipass

Get k3s with OpenFaaS using k3sup and multipass

multipass from Canoncial is like Docker Desktop, but for Ubuntu and works on MacOS, Linux and Windows.

Use-case:

We can get a Kubernetes cluster with k3s in a very short period of time. We can use this for workshops and building labs, and for R&D, including testing.

@gaplo917
gaplo917 / IntelliJ IDEA.app.vmoptions
Last active February 4, 2024 02:20
IntelliJ IDEA Java 17 ZGC VM Options
# Personal Feeling: using the following jvm config is smoother than default
# My Machine: Macbook pro M1max 64GB
# More Info: https://github.com/FoxxMD/intellij-jvm-options-explained
# Prerequisite (Intellij < 2022.2)
# 1. Install JetBrain Runtime 17 osx-aarch64 for Apple Silicon, https://github.com/JetBrains/JetBrainsRuntime/releases
# 2. Switch the runtime from JetBrain Runtime 11 to 17, https://www.jetbrains.com/help/idea/switching-boot-jdk.html
# JetBrain Toolbox
@mjbnz
mjbnz / nginx-rproxy-with-sso.md
Last active February 11, 2024 23:14
Nginx Reverse Proxy with simple SSO

Nginx Reverse Proxy for homelab services using SSO

NOTE: This document has now been added to the nginx-sso wiki, here. Any further updates will be made there.

Using:
@vvgsrk
vvgsrk / pre-requisites-before-starting-spark-shell-on-glue-dev-endpoint.properties
Last active December 2, 2019 05:44
Prerequisites before starting spark-shell on glue development endpoint
# Properties File : Create a properties file with the following configurations and name it as glue_spark_shell.properties
# Note: In below configurations, Replace the s3 access and secret keys with your key's
spark.hadoop.fs.s3a.impl org.apache.hadoop.fs.s3a.S3AFileSystem
spark.driver.extraClassPath /usr/share/aws/glue/etl/jars/*:/usr/lib/hadoop-lzo/lib/*:/usr/lib/hadoop/*:/usr/share/aws/aws-java-sdk/*:/usr/share/aws/emr/emrfs/lib/*:/usr/share/aws/hmclient/lib/*:/usr/share/java/Hive-JSON-Serde/*:/usr/share/aws/sagemaker-spark-sdk/lib/*:/usr/share/aws/emr/emrfs/conf:/usr/share/aws/glue/etl/python/PyGlue.zip:/usr/share/aws/emr/emrfs/auxlib/*:/usr/lib/hadoop/lib/native/*:/usr/share/aws/emr/security/conf:/usr/share/aws/emr/security/lib/*:/usr/share/aws/glue/etl/conf
spark.executor.extraClassPath /usr/share/aws/glue/etl/jars/*:/usr/lib/hadoop-lzo/lib/*:/usr/lib/hadoop/*:/usr/share/aws/aws-java-sdk/*:/usr/share/aws/emr/emrfs/lib/*:/usr/share/aws/hmclient/lib/*:/usr/share/java/Hive-JSON-Serd
@mxschmitt
mxschmitt / cmd.bat
Last active April 18, 2024 21:48
Golang example of cmd stderr / stdout merge to a single channel
@echo off
echo Stdout
echo Stderr 1>&2
@mezzomondo
mezzomondo / aurora_vertical_scaling.md
Last active October 10, 2023 12:32
Automatic vertical scaling of an Aurora cluster

The problem (AKA don't waste money)

One of my clients is a big company that has a very variable but predictable database usage pattern. In the weekdays morning they come up with a huge amount of INSERTs and UPDATEs while for the rest of the day, form noon on, the usage is fairly limited to a decent amount of SELECTs with very low writing activity. The smallest class type that can handle the morning's volume is db.r3.large but having such an instance running all day long and in the weekends is just a big waste of resources money (or a big favour we do to Amazon, from their point of view).

The solution

So I was wondering if there's some autoscaling mechanism for Aurora writers (there is, but only for replicas),

@soupi
soupi / Json.hs
Last active November 11, 2019 19:34
A simple JSON EDSL
{- | An EDSL for defining and printing JSON values
-}
import Data.List (intercalate)
----------------
-- JSON Model --
----------------
-- | The JSONValue data type represents a JSON Value
@Sandyman
Sandyman / elasticsearch.js
Created May 20, 2017 06:04
Index Elasticsearch documents streaming from DynamoDB
'use strict';
const Elasticsearch = require('aws-es');
const fetch = require('node-fetch');
const ES_SERVICE_ENDPOINT = process.env.ES_SERVICE_ENDPOINT;
const ES_INDEX_NAME = process.env.ES_DOMAIN_NAME;
const accessKey = process.env.ACCESS_KEY;
const secretKey = process.env.SECRET_ACCESS_KEY;