Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Quality is remembered long after the price is forgotten (Sir Frederick Royce)

Maksim Sokolnikov Bablzz

💭
Quality is remembered long after the price is forgotten (Sir Frederick Royce)
View GitHub Profile
@elfsternberg
elfsternberg / fizzbuzz.rs
Last active Feb 8, 2021
Pedantic FizzBuzz implementation in Rust
View fizzbuzz.rs
use std::fmt;
enum FizzBuzzOr {
Fizzbuzz(&'static str),
Or(i32)
}
impl fmt::Display for FizzBuzzOr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use FizzBuzzOr::*;
@YumaInaura
YumaInaura / 00_README.md
Last active Sep 29, 2021
Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.
View 00_README.md

Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

I was so confused to understand behaviior of Golang channels, buffer, blocking, deadlocking and groutines.

I read Go by Example topics.

@ekreutz
ekreutz / ansible_variable_precedence.md
Created Dec 22, 2017
Ansible variable precedence (order, hierarchy)
View ansible_variable_precedence.md
@VojtechVitek
VojtechVitek / slice-batch-in-parallel.go
Last active Oct 1, 2021
Golang - Loop over slice in batches (run something in parallel on a sub-slice)
View slice-batch-in-parallel.go
package main
import "fmt"
func main() {
slice := make([]int, 159)
// Split the slice into batches of 20 items.
batch := 20
@lilongen
lilongen / run-ansible-with-any-host-without-inventory
Last active Sep 14, 2021
How to run Ansible without specifying the inventory but the host directly?
View run-ansible-with-any-host-without-inventory
Question:
. How to run Ansible without specifying the inventory but the host directly?
. Run a playbook or command with arbitrary host not in the inventory hosts list?
. run ansible with arbitrary host/ip without inventory?
Answer:
Surprisingly, the trick is to append a ,
The host parameter preceding the , can be either a hostname or an IPv4/v6 address.
ansible all -i example.com,
@joyrexus
joyrexus / README.md
Created Feb 21, 2015
Functional config in go
View README.md

Quick demo of how to initialize your data structure with optional configuration parameters ... with sane defaults if left unspecified.

This functional config technique ...

  • lets you write APIs that can evolve without pain
  • provides meaningful configuration parameters
  • makes it easy to set default settings
  • makes it possible to set complex conditional values
@myusuf3
myusuf3 / delete_git_submodule.md
Created Nov 3, 2014
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@CristinaSolana
CristinaSolana / gist:1885435
Created Feb 22, 2012
Keeping a fork up to date
View gist:1885435

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream