Skip to content

Instantly share code, notes, and snippets.

View rogerwelin's full-sized avatar
:shipit:
Gopher

Roger Welin rogerwelin

:shipit:
Gopher
View GitHub Profile
@vinzenz
vinzenz / dial-pq-via-ssh.go
Last active October 7, 2024 09:00
Use postgres via SSH in Golang
package main
import (
"database/sql"
"database/sql/driver"
"fmt"
"net"
"os"
"time"
@imranity
imranity / create_master_keysource_credential.md
Last active June 15, 2018 10:40
Create a new jenkins global credential from a key source on jenkins master(groovy script)

Create a New jenkins global credential from a key stored on jenkins master

This script helps create a global credential in jenkins from a key source that is located in jenkins master.
You can change the name of key to whatever key exists on master.
Run this script either:

i) Jenkins-> manage Jenkins -> script console

ii) add to init.groovy to make it run during jenkins start

@rushilgupta
rushilgupta / GoConcurrency.md
Last active July 11, 2024 12:52
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@g-a-d
g-a-d / gist:4bc7f716bc57e42b64e1ef450be9bae8
Created November 6, 2017 15:41
Converting CloudFormation parameter files to CodePipeline Template Configuration files
Using jq, we can convert between CloudFormation parameter files and CodePipeline template configuration files:
$ jq '{ Parameters: [ .[] | { (.ParameterKey): .ParameterValue } ] | add } ' < cloudformation_parameter_file.json
This is useful in the case of receiving 'Template configuration is not valid' when running a CloudFormation action.
A CloudFormation parameter file has format:
[
{
@olivere
olivere / elastic_v6_getting_started.go
Created March 1, 2018 07:27
Getting started with Elastic v6
package main
import (
"context"
"encoding/json"
"fmt"
"reflect"
"github.com/olivere/elastic"
)