Skip to content

Instantly share code, notes, and snippets.

@aladine
aladine / Solution.kt
Created June 14, 2020 23:32
Dutch National Flag Problem
class Solution {
fun swapColor(nums: IntArray, k: Int, l: Int) {
val tmp = nums[k]
nums[k] = nums[l]
nums[l] = tmp
}
fun sortColors(nums: IntArray) {
var l = 0
var m = 0
CXX = g++
CPPFLAGS = -Wall -std=c++11 -O2
LD_FLAGS =
FILE = mock/contest
SOURCES = $(FILE).cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXE = $(FILE).out
all: $(SOURCES) $(EXE)
{
"basics": {
"name": "Dan Tran",
"picture": "https://avatars1.githubusercontent.com/u/287410?v=4",
"label": "Senior Software Developer Engineer",
"headline": null,
"summary": "",
"website": null,
"blog": "https://aladine.gitlab.io/blog/",
"yearsOfExperience": 10,
@aladine
aladine / keybase.md
Created January 21, 2020 06:14
keybase.md

Keybase proof

I hereby claim:

  • I am aladine on github.
  • I am danlepetit (https://keybase.io/danlepetit) on keybase.
  • I have a public key ASDg2p2Phi0lwcxyNhck4usJ11npKCErmZFwSURBeC-ERwo

To claim this, I am signing this object:

@aladine
aladine / NOTES.md
Created November 15, 2019 07:39 — forked from DenisIzmaylov/NOTES.md
Step By Step Guide to Configure a CoreOS Cluster From Scratch

Step By Step Guide to Configure a CoreOS Cluster From Scratch

This guide describes how to bootstrap new Production Core OS Cluster as High Availability Service in a 15 minutes with using etcd2, Fleet, Flannel, Confd, Nginx Balancer and Docker.

Content

pub const WHITE: usize = 0; // X
pub const BLACK: usize = 1; // O
pub const FIELD: u32 = 0x1FF << 16;
pub const SQUARE: u32 = 0xFFFF;
pub const ALL_FIELDS_LEGAL: u32 = 0x1 << 25;
pub const DIAGS: [u32; 2] = [0o421, 0o124];
pub const ROWS: [u32; 3] = [0o700, 0o070, 0o007];
pub const COLS: [u32; 3] = [0o111, 0o222, 0o444];
@aladine
aladine / pre-commit.sh
Created September 30, 2019 12:15 — forked from radlinskii/pre-commit.sh
This is a pre-commit hook file for working in Go. Be sure to save this file in your repository as `.git/hooks/pre-commit` and give it right to execute e.g. with command `chmod +x .git/hooks/pre-commit`
#!/bin/sh
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports
@aladine
aladine / org-mode-reference-in.org
Created September 23, 2018 14:22 — forked from drj42/org-mode-reference-in.org
This is a cheat sheet for Emacs org-mode... in org-mode format!
@aladine
aladine / command.go
Created August 25, 2018 16:16
Main errors from hystrix circuit breaker
// ErrMaxConcurrency occurs when too many of the same named command are executed at the same time.
ErrMaxConcurrency = CircuitError{Message: "max concurrency"}
// ErrCircuitOpen returns when an execution attempt "short circuits". This happens due to the circuit being measured as unhealthy.
ErrCircuitOpen = CircuitError{Message: "circuit open"}
// ErrTimeout occurs when the provided function takes too long to execute.
ErrTimeout = CircuitError{Message: "timeout"}
@aladine
aladine / command.go
Created August 25, 2018 15:36
Circuit Setting struct
// CommandConfig is used to tune circuit settings at runtime
type CommandConfig struct {
Timeout int `json:"timeout"`
MaxConcurrentRequests int `json:"max_concurrent_requests"`
RequestVolumeThreshold int `json:"request_volume_threshold"`
SleepWindow int `json:"sleep_window"`
ErrorPercentThreshold int `json:"error_percent_threshold"`
}