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 / M2M_Association_SQLalchemy.py
Created September 21, 2017 12:37 — forked from SuryaSankar/M2M_Association_SQLalchemy.py
An example of a many to many relation via Association Object in SQLAlchemy
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
import uuid
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()
@euclid1990
euclid1990 / gist:0e052c49a54a14e6b5b7de10401d40d5
Created April 10, 2019 08:53
Karabiner Complex Modification Rules
"rules": [
{
"description": "print_screen to command+shift+3",
"manipulators": [
{
"from": {
"key_code": "print_screen"
},
"to": [
{
@euclid1990
euclid1990 / karabiner.json
Last active February 8, 2023 03:42
Karabiner Complex Modification Rules - OSX + Filco/Durgod/Akko/LeoPold
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@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
@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 / 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 / Releaseflow.md
Last active July 2, 2019 16:52 — forked from fujimaki-k/Releaseflow.md
リリースまでの流れ

リリースまでの流れ

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

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

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

// 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 / .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
@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{}