Skip to content

Instantly share code, notes, and snippets.

View Bablzz's full-sized 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 February 8, 2021 08:11
Pedantic FizzBuzz implementation in Rust
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 July 22, 2023 03:58
Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

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
Last active April 23, 2024 16:52
Ansible variable precedence (order, hierarchy)
@troyfontaine
troyfontaine / 1-setup.md
Last active April 23, 2024 23:50
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@VojtechVitek
VojtechVitek / slice-batch-in-parallel.go
Last active December 25, 2023 09:42
Golang - Loop over slice in batches (run something in parallel on a sub-slice)
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 May 5, 2023 23:16
How to run Ansible without specifying the inventory but the host directly?
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 February 21, 2015 14:21
Functional config in go

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 November 3, 2014 17:36
How effectively delete a git submodule.

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 February 22, 2012 14:56
Keeping a fork up to date

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