Skip to content

Instantly share code, notes, and snippets.

View antonlindstrom's full-sized avatar
👓

Anton Lindström antonlindstrom

👓
View GitHub Profile
@rushilgupta
rushilgupta / GoConcurrency.md
Last active January 25, 2024 14:59
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

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@mattratleph
mattratleph / vimdiff.md
Last active April 24, 2024 11:28 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@dcarley
dcarley / gist:3811003
Created October 1, 2012 11:11 — forked from apsoto/gist:2869888
Diagram Showing EC2 Security Group Data Flows
#!/usr/bin/env ruby
require 'fog'
require 'graphviz'
ec2 = Fog::Compute.new(:provider => 'AWS')
graph = GraphViz::new("structs", "type" => "graph")
groups = ec2.security_groups
group_map = Hash[groups.collect { |g| [g.group_id, g.name] }]
@dcarley
dcarley / Gemfile
Created September 27, 2012 10:26
Smoke testing Puppet nodes
source :rubygems
gem 'puppet', '~> 2.6.0'
gem 'facter'
gem 'randexp'
#!/bin/bash
#
# This is the script responsible for updating our Puppet master data,
# which includes modules, manifests, hiera data, etc. All of this data is
# managed in a git repository and upon "deploy" it is synced into the Puppet
# master.
#
# This script mirrors the remote git repository, looking for branches that
# match "env-*" (such as "env-production" or "env-test"). Each of these branches
# is setup as an environment into the Puppet master's data files. The
@jordansissel
jordansissel / Procfile
Created April 5, 2012 19:29
Jenkins on Heroku
# Only listen on http; disable ajp and https
web: java -jar jenkins.war --httpPort=$PORT --ajp13Port=-1 --httpsPort=-1

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@aussielunix
aussielunix / .gitignore
Last active April 12, 2018 17:37
jenkins configs to github
*
!/.gitignore
!/*.xml
!/nextBuildNumber
!/jobs
!/jobs/*
!/jobs/*/*.xml
/jobs/*/disk-usage.xml
/jobs/*/builds
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.