Skip to content

Instantly share code, notes, and snippets.

View alaindet's full-sized avatar

Alain D'Ettorre alaindet

View GitHub Profile
@alexedwards
alexedwards / Makefile
Last active June 21, 2024 05:52
Boilerplate Makefile for Go projects
# Change these variables as necessary.
MAIN_PACKAGE_PATH := ./cmd/example
BINARY_NAME := example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
@candlerb
candlerb / go-project-layout.md
Last active April 24, 2024 19:22
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@RSheremeta
RSheremeta / go_robust_runner_test.go
Last active January 11, 2024 01:44
Pure Go implementation of BeforeEach / AfterEach and BeforeSuite / AfterSuite testing mechanisms
// DISCLAIMER:
// ideally, this snippet shouldn't be used as a separate file
// all the stuff should be divided into kinda logical parts and stored in files respectively
// it's all gathered here in one single place for the demonstration purposes only
package go_medium
import (
"fmt"
"os"
@jonlabelle
jonlabelle / npm_version_cheatsheet.md
Last active July 3, 2024 06:07
npm version cheatsheet

npm version cheatsheet

npm uses Semantic Versioning

npm uses Semantic Versioning. Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards compatible manner, and
  3. PATCH version when you make backwards compatible bug fixes.
@alexedwards
alexedwards / main.go
Created November 15, 2020 10:38
JSON decoding benchmarks
package main
import (
"encoding/json"
"io/ioutil"
"net/http"
)
func createMovieHandlerUnmarshal(w http.ResponseWriter, r *http.Request) {
var input struct {
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active July 3, 2024 12:38
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@munho
munho / left_fn.json
Created June 3, 2020 23:55
Home, End, Page Up, Page Down keys for Logitech K380 (with Logitech Options uninstalled for fn and installed for option)
{
"title": "Home, End, Page Up, Page Down keys for Logitech K380 (with Logitech Options uninstalled)",
"rules": [
{
"description": "Change left arrow + fn to home",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_arrow",
@JanMalch
JanMalch / Angular - custom structural directives.md
Last active June 9, 2024 16:30
Writing your own structural directives with context variables

Writing your own structural directives with context variables

Complete code in math.directive.ts

After reading this you will be able to create a structural directive with inputs and context variables and use it like this:

<div *math="10; exponent: 3; let input; 
            let exponent = exponent; let r = root;
 let p = power; let ctrl = controller"&gt;
@RichardBronosky
RichardBronosky / Storing-git-Credentials.md
Last active July 30, 2023 05:34
Storing git Credentials
@henfiber
henfiber / KB-Buying-guide-EU.md
Last active July 2, 2024 08:16
Buying keyboards and keyboard components from EU

Europe

  • SkinFlint : Price comparison site which has some nice filtering options per switch type etc. Searches for offers in UK, Germany, Poland and Austria
  • mykeyboard.eu : Keyboards, keycaps and accessories. Based in Belgium.
  • candykeys.com : European Store selling Vortex, Leopold, KBP, Anne Pro keyboards, keycap sets and components (ISO + ANSI). Based in Germany, ships to EU.
  • falba.tech : custom wooden bamboo cases, and some acrylic and carbon ones. Switch packs (65 browns at 48EUR). Other parts for the GH60, Atreus, ErgoDox. Also Microcontrollers, diodes, leds etc.
  • 42keebs.eu - Mostly PCBs, tools and accessories. Located in Czech Republic.
  • KEYGEM : Switches, Keycaps, lubes, cables, DIY kits and deskmats. Based in Germany, ships to the EU and worldwide.
  • [Eloquent Clicks - Custom Mechanical Keyboard Store](https://www.eloquen