... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| # alias to edit commit messages without using rebase interactive | |
| # example: git reword commithash message | |
| reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
| # sync all your github forks from all your organizations | |
| gh org list --limit 1000 --json login | jq -r '.[].login' | xargs -r -n1 -P4 sh -c 'gh repo list "$1" --fork --limit 1000 --json nameWithOwner | jq -r ".[].nameWithOwner"' _ | xargs -r -n1 -P8 gh repo sync --force | |
| # sync all your github forks in an organization | |
| gh repo list YOUR_ORG_NAME --fork --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -P 8 -I {} gh repo sync "{}" --force |
| #!/usr/bin/env bash | |
| # | |
| # Add new version of nodejs to a nodejs or no.de SmartMachine | |
| # | |
| # Check to see if script is being run as the root user | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "This script must be run as root. Aborting..." 1>&2 | |
| exit 1 |
| require 'date' | |
| require 'benchmark' | |
| puts "patchlevel: #{RUBY_PATCHLEVEL}, release_date: #{RUBY_RELEASE_DATE}, ruby_version: #{RUBY_VERSION}, ruby_platform: #{RUBY_PLATFORM}" | |
| puts '*'*80 | |
| Benchmark.bm(10) do |bm| | |
| bm.report("Date.today") do | |
| 500_000.times { Date.today } |
| # Returns a randomly generated sentence of lorem ipsum text. | |
| # The first word is capitalized, and the sentence ends in either a period or | |
| # question mark. Commas are added at random. | |
| def sentence | |
| # Determine the number of comma-separated sections and number of words in | |
| # each section for this sentence. | |
| sections = [] | |
| 1.upto(rand(5)+1) do | |
| sections << (WORDS.sort_by{rand}.slice(0...(rand(9)+3)).join(" ")) |