I was so confused to understand behaviior of Golang channels, buffer, blocking, deadlocking and groutines.
I read Go by Example topics.
<?php declare(strict_types=1); | |
// @mathiasverraes | |
// parser is a function that takes some input and returns (either (structured value AND remainder) OR error) | |
// parser is a function that takes some input and returns a Result | |
$a = function ($input) { | |
$parsed = substr($input, 0, 1); | |
$remainder = substr($input, 1); | |
if ($parsed === 'a') return succeed($parsed, $remainder); else return fail("expected a"); | |
}; |
package main | |
import ( | |
"testing" | |
) | |
var sink1 = 0 | |
func BenchmarkNotDefered(b *testing.B) { | |
for n := 0; n < b.N; n++ { |
package main | |
// This is an example of a resilient worker program written in Go. | |
// | |
// This program will run a worker, wait 5 seconds, and run it again. | |
// It exits when SIGINT or SIGTERM is received, while ensuring any ongoing work | |
// is finished before exiting. | |
// | |
// Unexpected panics are also handled: program won't crash if the worker panics. | |
// However, panics in goroutines started by the worker won't be handled and have |
minikube stop; minikube delete && | |
docker stop $(docker ps -aq) && | |
rm -rf ~/.kube ~/.minikube && | |
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube && | |
launchctl stop '*kubelet*.mount' && | |
launchctl stop localkube.service && | |
launchctl disable localkube.service && | |
sudo rm -rf /etc/kubernetes/ && | |
docker system prune -af --volumes |
relates to moby/moby#32507, moby/buildkit#442
Doing some silly experimenting with RUN --mount
:
# syntax=docker/dockerfile:1
FROM alpine AS stage1
If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:
let
and const
statements. For the purposes of the React documentation, you can consider them equivalent to var
.class
keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this
in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Javimport torch | |
from torch import nn | |
from torch.autograd import Variable | |
import torch.nn.functional as F | |
import torch.optim as optim | |
# toy feed-forward net | |
class Net(nn.Module): | |
def __init__(self): |
FROM golang:1.9 | |
WORKDIR /go/src/github.com/purplebooth/example | |
COPY . . | |
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go | |
FROM scratch | |
COPY --from=0 /go/src/github.com/purplebooth/example/main /main | |
CMD ["/main"] |
These are generic npm scripts that you can copy & paste into your package.json
file as-is and get access to convinience scripts to manage your Docker images all in one place.
npm i -g mrm-task-npm-docker
npx mrm npm-docker
Here's the code repository https://github.com/expertly-simple/mrm-task-npm-docker