Skip to content

Instantly share code, notes, and snippets.

@aaronice
aaronice / fibonacci_closure.go
Created April 10, 2019 00:18 — forked from tetsuok/fibonacci_closure.go
An answer of the exercise: Fibonacci closure on a tour of Go
package main
import "fmt"
// Very naive answer.
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n := 0
a := 0
@aaronice
aaronice / docker_tips.md
Created November 9, 2018 23:35
Docker Tips #Docker

Start a shell session in a running container (without ssh)

$ docker exec -it "id of running container" bash
@aaronice
aaronice / saltstack.md
Last active November 9, 2018 22:25
Salt Stack @saltstack

WHAT IS SALT

Salt is a different approach to infrastructure management, founded on the idea that high-speed communication with large numbers of systems can open up new capabilities. This approach makes Salt a powerful multitasking system that can solve many specific problems in an infrastructure.

The backbone of Salt is the remote execution engine, which creates a high-speed, secure and bi-directional communication net for groups of systems.

On top of this communication system, Salt provides a configuration management system called Salt States

@aaronice
aaronice / diff.md
Created October 24, 2018 22:43
Diff Use Cases

diff

$ rq folder1 folder2
@aaronice
aaronice / docker_ssh_setup.md
Last active November 8, 2018 00:37
Docker SSH Setup

For mounted volume in VM or attached volume in Docker container, you may copy your SSH public and private key to the "shared" directory, and then copy then to the virtual environment SSH folder (~/.ssh/), such as:

$ cp id_rsa ~/.ssh/id_rsa
$ cp id_rsa.pub ~/.ssh/id_rsa.pub
$ eval `ssh-agent`
$ ssh-add

Or else, generate a new SSH key pairs and add the public key to GitHub (may refer to the "Generating a new SSH Key" help documentation on GitHub)

@aaronice
aaronice / custom.css
Created August 1, 2018 00:58
Custom CSS for Dark Mode Chrome Extension
/*
Parts of this code is inspired from the following:
[1] https://userstyles.org/styles/105000/smart-dark
*/
html {
background-color: #222 !important;
}
body {
@aaronice
aaronice / css_typography.md
Last active June 8, 2018 22:16
CSS Typography

Web-safe Fonts and Font Family

Serif and Sans Serif Typefaces

  • Serif typefaces - small decorative lines;
  • Sans serif typefaces - no decorative lines;

Script and Decorative Typefaces

  • Script typefaces - hand-lettered look;
@aaronice
aaronice / proc_msg_example.erl
Last active June 7, 2018 21:04
Erlang Process Example
launch() ->
register(echo, spawn(demo, echo, [])).
echo() ->
receive
{Pid, Msg} ->
Pid ! Msg,
echo()
end.