timeout 40s /bin/bash -c "while ! httping -qc1 http://somehost:8080/app ; do sleep 1 ; done; echo OK" || echo TIMEOUT
If the service cannot be reached within 40s then TIMEOUT will be printed otherwise OK.
package pprof | |
import ( | |
"fmt" | |
"net" | |
"net/http" | |
"net/http/pprof" | |
"runtime" | |
rpprof "runtime/pprof" | |
"runtime/trace" |
## 1) GENERATE AN API TOKEN (https://circleci.com/gh/<gh-user>/<gh-repo-name>/edit#api) | |
## 2) ADD ENV VAR WITH NAME "CIRCLE_API_TOKEN" WITH PREVIOUS GENERATED TOKEN | |
version: 2 | |
jobs: | |
build: | |
machine: true | |
steps: | |
- run: | |
name: Build App |
function main { | |
Update-Windows-Configuration | |
Install-Utils | |
Install-Browsers | |
Install-Fonts |
timeout 40s /bin/bash -c "while ! httping -qc1 http://somehost:8080/app ; do sleep 1 ; done; echo OK" || echo TIMEOUT
If the service cannot be reached within 40s then TIMEOUT will be printed otherwise OK.
Just plug in your own values for registry and repo/image name.
registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
curl -sSL -I \
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
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:
This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.
While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.
Go's "multiple return values" feature, can be used for several purposes. Among them for failure reporting to the function caller. Go has two conventions for failure reporting, but currently, no clear convention for which to use when. I've encountered different programmers that prefer different choices in different cases. In this article, we will discuss the two, and try to make the process of choosing our next function signature more conscious.
As we all know, Go 2 is on its way and despite the hesitations, it's clear that without generics, it would end up being a disappointment. And although we are still gathering real-life use-cases, or experience reports, there's nothing bad about starting to think about how generics in Go could look like. I've come up with a few ideas which I'd love to share. So, here we go!
Now, Go 1 has no generics, but has interfaces. Interfaces (sometime accompanied by reflection)