... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| var fs = require('fs'); | |
| var infile = process.argv[2]; | |
| if (!infile) return console.log("need infile"); | |
| var data = fs.readFileSync(infile, 'utf8').split('\n'); | |
| var outlines = []; | |
| data.forEach(function(item) { |
| // Playbook - http://play.golang.org/p/3wFl4lacjX | |
| package main | |
| import ( | |
| "bytes" | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "crypto/rand" | |
| "encoding/base64" |
| /* | |
| * Genarate rsa keys. | |
| */ | |
| package main | |
| import ( | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "crypto/x509" |
curl to get the JSON response for the latest releasegrep to find the line containing file URLcut and tr to extract the URLwget to download itcurl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \| import * as Rx from "rxjs/Rx"; | |
| import * as uuid from "uuid"; | |
| import {IRequest} from "./common"; | |
| let button = document.querySelector("button"); | |
| let iframe = document.createElement("iframe"); | |
| iframe.src = "/proxy.html"; | |
| document.body.appendChild(iframe); |
| # Like "git branch", but also show colorized (and aligned!) branch descriptions. | |
| # Git branch descriptions can be created using "git branch --edit-description". | |
| gb() { | |
| maxlen=0 | |
| branches=$(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||') | |
| for branch in $branches; do | |
| len=${#branch} | |
| if [ "$len" -gt "$maxlen" ]; then | |
| maxlen="$len" | |
| fi |
Why? I wanted an easy way to paste URLs that I use and share a lot.
How? It's just a domain plus a big list of urls (see links.conf) which I edit with a script (see links.sh)
Also: People kept asking for an index page, so I made one (https://github.com/statico/statico-link-list). I'll add social media previews when I can get it to work.
| #!/usr/bin/env bash | |
| # Define ANSI color escape code | |
| # color <ansi_color_code> | |
| color() { printf "\033[${1}m"; } | |
| # No Color | |
| NO_COLOR=$(color "0") | |
| NC=${NO_COLOR} |