Skip to content

Instantly share code, notes, and snippets.

View hartfordfive's full-sized avatar

Alain L hartfordfive

View GitHub Profile
@ateucher
ateucher / setup-gh-cli-auth-2fa.md
Last active May 3, 2024 11:06
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
@dasgoll
dasgoll / gist:407a086904cd216d7dffaaacc918cc05
Last active February 28, 2018 18:30
Chef get cookbook name
## in cookbook/recipes/default.rb, can't be used in environments
puts run_context.cookbook_collection[cookbook_name].name
puts run_context.cookbook_collection[cookbook_name].version
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active June 18, 2025 21:59
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@smo921
smo921 / consul_lock.go
Last active August 23, 2023 08:08
Go consul lock example
package mrha
import (
"log"
consulapi "github.com/hashicorp/consul/api"
)
// Lock stores data for a consul lock
type Lock struct {
@ursuad
ursuad / kafka-cheat-sheet.md
Last active June 17, 2025 10:00
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@hartfordfive
hartfordfive / gist:1a9647a02273db1d38e1b32a001c7b56
Created July 8, 2016 20:39
One-line bash command to delete multiple Elasticsearch indices, based on a pattern
# Useful when the "action.disable_delete_all_indices" setting is set to "false"
for I in $(curl --silent 'http://[ES_HOST]:9200/_cat/indices/[INDEX_PATTERN]*?v&h=i'); do curl -XDELETE http://[ES_HOST]:9200/$I; done
@eliquious
eliquious / README.md
Created January 4, 2016 05:01
Golang OpenPGP examples

Building

go build -o goencrypt main.go

Generating Keys

@josephspurrier
josephspurrier / sshremote.go
Last active May 27, 2021 19:54
Golang Remote Execution
package main
/*
// Example
sci := ServerConnInfo{
"127.0.0.1",
"22",
"ubuntu",
`key.pem`,
}
@dstagner
dstagner / gist:193207fed46acf5b5bae
Last active June 11, 2025 14:47
Ruby ISO8601 time in milliseconds

So you want to generate ISO8601 formatted timestamps in Ruby, but need resolution finer than a second?

First, make sure to require 'time' in order to get ISO8601 formatting. But that gets you this:

2.1.0 :001 > require 'time'
 => true 
2.1.0 :002 > Time.now.utc.iso8601
 => "2015-11-12T04:46:43Z"