Skip to content

Instantly share code, notes, and snippets.

rushilgupta /
Last active Nov 17, 2020
Concurrency in golang and a mini Load-balancer


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: 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:


joshdover /
Last active Nov 1, 2020
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.


I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

ovolve / sumperms1234.ipynb
Last active May 17, 2016
Brute forcing a menacing maths problem
View sumperms1234.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17twenty / GoWithC.go
Last active Jul 11, 2016
Cross Compiling and Language Interop oh my!
View GoWithC.go
package main
import (
func main() {
#!/bin/bash -e
# Make sure you have installed ImageMagick
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
View gist:46e6b51c0d45faa6c561

An Example of Play

To further clarify what really goes on during an AD&D game, read the following example. This is typical of the sort of action that occurs during a playing session. Shortly before this example begins, three player characters fought a skirmish with a wererat (a creature similar to a werewolf but which becomes an enormous rat instead of a wolf). The wererat was wounded and fled down a tunnel. The characters are in pursuit. The group includes two fighters and a cleric.

Fighter 1 is the group's leader.

View nuget-dependency-visualizer.fsx
#r @"packages\Streams.0.2.5\lib\Streams.Core.dll"
open System
open System.IO
open System.Collections.Generic
open Nessos.Streams
// make Visual Studio use the script directory
DamianMac / gist:cab420adb9f9a915b028
Created Oct 30, 2014
Create a release with Octopus Client API
View gist:cab420adb9f9a915b028
var server = "http://yourserveraddress:8065/"; //Your server and IP address
var apiKey = "API-XXXXXXXXXXXXXXXXXXXXXXXXX"; // Get this from your 'profile' page in the Octopus web portal
var endpoint = new OctopusServerEndpoint(server, apiKey);
var repository = new OctopusRepository(endpoint);
var projectId = "projects-225"; //your project id
//This pulls out the info you need, the same call that's made on the Create Release page in the UI
var template = repository.Client.Get<Octopus.Client.Model.ReleaseTemplateResource>("/api/deploymentprocesses/deploymentprocess-" + projectId + "/template");
kachayev /
Last active Nov 18, 2020
Channels Are Not Enough or Why Pipelining Is Not That Easy
dmarcato / strip_play_services.gradle
Last active Sep 15, 2020
Gradle task to strip unused packages on Google Play Services library
View strip_play_services.gradle
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
return result
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
You can’t perform that action at this time.