Skip to content

Instantly share code, notes, and snippets.

View euclid1990's full-sized avatar
🍔
Code for food

Nguyen Van Vuong (Vic) euclid1990

🍔
Code for food
View GitHub Profile
@euclid1990
euclid1990 / Dockerfile
Last active June 21, 2024 08:46
Horizontal Pod Autoscaler / Go / K8s
FROM --platform=linux/amd64 golang:1.22.4
WORKDIR /app
COPY main.go ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -o /go-hpa
EXPOSE 8080
CMD ["/go-hpa"]
@euclid1990
euclid1990 / NULL_AS_MAX.sql
Created November 11, 2021 04:57
Consider NULL as MAX in SQL
DROP FUNCTION IF EXISTS fconsider_null_as_max;
DELIMITER //
CREATE FUNCTION fconsider_null_as_max (originalYear INT)
RETURNS INT
BEGIN
RETURN CASE
WHEN MAX(originalYear IS NULL) = 0 THEN MAX(originalYear)
ELSE originalYear
END;
END; //
@euclid1990
euclid1990 / iTerm2-profile.json
Last active November 7, 2021 15:30
iTerm2 Profile - Config word/line deletion and navigation shortcut
{
"Ansi 1 Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0.73333334922790527
},
"Tags" : [
],
"Ansi 12 Color" : {
@euclid1990
euclid1990 / main.go
Last active October 27, 2021 10:06
Go - Singleton Pattern
package main
import (
"fmt"
"sync"
)
var (
doOnce sync.Once
doLock = &sync.Mutex{}
@euclid1990
euclid1990 / .zshrc
Last active May 18, 2021 07:22
Terminator Config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$PATH:/usr/local/go/bin:$HOME/.rvm/bin
# Path to your oh-my-zsh installation.
export ZSH="/home/euclid/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
// these are labels for the days of the week
cal_days_labels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
// these are human-readable month name labels, in order
cal_months_labels = ['January', 'February', 'March', 'April',
'May', 'June', 'July', 'August', 'September',
'October', 'November', 'December'];
// these are the days of the week for each month, in order
cal_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
@euclid1990
euclid1990 / Releaseflow.md
Last active July 2, 2019 16:52 — forked from fujimaki-k/Releaseflow.md
リリースまでの流れ

リリースまでの流れ

1. フィーチャーブランチの作成

  • develop ブランチから新たに作成する機能のためのフィーチャーブランチを作成します。
git branch feature/new_feature develop

2. プログラムの開発とテスト

@euclid1990
euclid1990 / VagrantFile
Created June 24, 2019 08:41 — forked from yudaykiran/VagrantFile
VagrantFile for automating Kubernetes Setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.0"
# K8s Master Nodes
M_NODES = ENV['M_NODES'] || 1
@euclid1990
euclid1990 / php-pools.md
Created June 6, 2019 09:39 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@euclid1990
euclid1990 / gist:c3042ba8807ce1468703ecb90c68aa28
Created June 6, 2019 09:38 — forked from edavis/gist:1395977
Get memcached working with SASL
Download memcached source
./configure --enable-sasl --enable-sasl-pwdb
make
echo "user:password" > memcached-sasl-pwdb
export MEMCACHED_SASL_PWDB=memcached-sasl-pwdb
./memcached -S -vv
Don't need anything with sasl, saslpasswd2, or memcached.conf