Skip to content

Instantly share code, notes, and snippets.

@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
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 / 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

@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:

{
"basics": {
"name": "Trong Dan Tran",
"picture": "https://avatars1.githubusercontent.com/u/287410?v=4",
"label": "Senior Software Developer Engineer",
"headline": "Experienced Software Developer Engineer | Mobile & Backend Systems Specialist | Cloud-Driven Solutions",
"summary": "",
"website": null,
"blog": "https://aladine.gitlab.io/blog/",
"yearsOfExperience": 13,
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)
@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