Skip to content

Instantly share code, notes, and snippets.

Dreampuf dreampuf

Block or report user

Report or block dreampuf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dreampuf / calc.y
Last active Aug 22, 2019
hostlist generate by goyacc
View calc.y
package main
dreampuf /
Created Aug 7, 2019
Build a Node Exporter RPM package
# Extract Node Exporter RPM package
# Download the official tar package
dreampuf /
Created Apr 8, 2019
How to enable admission-pulgins in kubernetes of docker-desktop
# Install docker and kubernetes first
# Helpful link:
# Then you need to get into the virtual machine by (it may change in the future, but the path should be similar)
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
# Change the line in /etc/kubernetes/manifests/kube-apiserver.yaml
# - --enable-admission-plugins=Initializers,NodeRestriction
# to
# - --enable-admission-plugins=Initializers,NodeRestriction,ValidatingAdmissionWebhook,MutatingAdmissionWebhook
dreampuf /
Last active Mar 11, 2019
How to install golang 1.11 in CentOS5
# details in:
# a patch for centos 5 build:
export GOROOT="/usr/local/go"
export PATH="$GOROOT/bin:$PATH"
mkdir /usr/local/go ~/go
curl -L | tar xf - -C /usr/local/go
cd /usr/local/go/src
curl -L | tar xf - -C ~/go
View Chinese Stop Words
dreampuf /
Last active Feb 5, 2019
How to use Amazon ECR as service in GitlabCI jobs


OK, I've experimented a lot getting this going with the docker+machine executor (specifically with the amazonec2 driver, which I suspect is quite common for people looking at this thread!), it may also be helpful to others when debugging what's going on for them.

docker+machine is interesting because it has several relevant contexts (i.e. a file system and environment variables), which I shall refer to as:

  • "runner": what is running the gitlab-runner binary - in my case this is an ECS-managed docker container for the gitlab/gitlab-runner image on docker hub, but it could the systemd service configuration if you're running directly on the machine.
  • "job host": the docker-machine created machine (e.g. EC2 instance) that runs the docker daemon
  • "job container": the docker container for the image specified in the project .gitlab-ci.yaml (or the default in config.toml)
dreampuf /
Created Dec 4, 2018
Add a posthook to prometheus pushgateway
# cat
while true; do
echo -e "HTTP/1.1 200 OK\n\n# $(date)" | nc -l 9092 &> /dev/null;
sleep 3;
curl -s "http://${PUSHGATEWAY_SERVER}/metrics" | sed -ne "s/push_time_seconds{instance=\"\([[:alnum:].]*\)\",job=\"${JOB_NAME}\".*/\1/p" | xargs -I INSNAME curl -X DELETE http://${PUSHGATEWAY_SERVER}/metrics/job/${JOB_NAME}/instance/INSNAME &> /dev/null;
dreampuf /
Created Nov 27, 2018
Convert cronjob file to SaltStack state
import re
cronjob_content = """ PAST YOUR CRONJOB HERE """
cronjob_regex = re.compile(r'^([^#]\S*?) (\S+) (\S+) (\S+) (\S+)\s+(.+)$')
for n, (minute, hour, daymonth, month, dayweek, exp) in enumerate([i.groups() for i in map(, d.splitlines()) if i], 1):
print "cronjob-%02d:" % n
print " cronjob.present:"
for k, v in {"minute": minute, "hour": hour, "daymonth": daymonth, "month": month, "dayweek": dayweek}.items():
if v != "*":
dreampuf /
Last active Nov 19, 2018
#!/usr/bin/env bash
# Install Homebrew first
/usr/bin/ruby -e "$(curl -fsSL"
# Basic development tools
brew install pyenv awscli pyenv-virtualenv go
# Enable caskroom
brew tap caskroom/cask
dreampuf / main_test.go
Created Nov 8, 2018
How to handle sub process gently in Golang
View main_test.go
package main
import (
You can’t perform that action at this time.