Skip to content

Instantly share code, notes, and snippets.

Avatar

Dreampuf dreampuf

View GitHub Profile
@dreampuf
dreampuf / readme.md
Last active Feb 22, 2021
How to use Amazon ECR as service in GitlabCI jobs
View readme.md

Source: https://gitlab.com/gitlab-org/gitlab-runner/issues/1583#note_93170156

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)
View Chinese Stop Words
,
?
@dreampuf
dreampuf / bootstrap_develop_environment.sh
Last active Oct 20, 2020
Bootstrap_develop_environment.sh
View bootstrap_develop_environment.sh
#!/usr/bin/env bash
# Install Homebrew first
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Basic development tools
brew install pyenv awscli pyenv-virtualenv go
# Enable caskroom
brew tap caskroom/cask
View gist:3946886
#!/usr/bin/env python
#vim: encoding=utf-8
"""
拼音分词
"""
__author__ = "dreampuf<soddyque@gmail.com>"
import unittest
@dreampuf
dreampuf / go_installation.sh
Last active Sep 13, 2020
How to install golang 1.11 in CentOS5
View go_installation.sh
# details in: https://golang.org/doc/install/source
# a patch for centos 5 build: https://github.com/golang/go/issues/24980#issuecomment-384193598
export GOROOT="/usr/local/go"
export PATH="$GOROOT/bin:$PATH"
mkdir /usr/local/go ~/go
curl -L https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz | tar xf - -C /usr/local/go
cd /usr/local/go/src
./make.bash
curl -L https://dl.google.com/go/go1.11.src.tar.gz | tar xf - -C ~/go
@dreampuf
dreampuf / launch.sh
Created Jul 8, 2020
How to create a vuejs3 project
View launch.sh
vue create PROJECT_NAME
# select features you need
cd PROJECT_NAME
vue add vue-next
rm src/shims-tsx.d.ts
sed -i '' 's/RouteConfig/RouteRecordRaw/g' src/router/index.ts # https://github.com/vuejs/vue-router-next/commit/fd49bbd085e9df7804994ea188f94384ac22e048
patch -p1 <<'EOF'
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
index dc773ba..01a7286 100644
--- a/src/components/HelloWorld.vue
@dreampuf
dreampuf / install_openjdk8.sh
Last active Jul 2, 2020
Install JDK8 on Jessie in 2020
View install_openjdk8.sh
cat > /etc/apt/sources.list.d/openjdk.list <<"EOF"
deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main
EOF
apt-get update
apt install -t jessie-backports openjdk-8-jdk
update-alternatives --config java # select java1.8
@dreampuf
dreampuf / bash
Last active Mar 21, 2020
How to get the golang package version of the latest git repo commit
View bash
# Credit: https://stackoverflow.com/a/59440771/398634
TZ=UTC git --no-pager show \
--quiet \
--abbrev=12 \
--date='format-local:%Y%m%d%H%M%S' \
--format="%cd-%h"
@dreampuf
dreampuf / main.go
Last active Dec 10, 2019
Golang SSHAgent Usage Example
View main.go
package main
/*
Golang SSHAgent Usage
https://orebibou.com/2019/03/golang%E3%81%A7ssh-agent%E3%81%8B%E3%82%89%E9%8D%B5%E3%82%92%E5%8F%96%E5%BE%97%E3%81%97%E3%81%A6ssh%E6%8E%A5%E7%B6%9A%E3%81%99%E3%82%8B/
*/
import (
"fmt"
"golang.org/x/crypto/ssh"
@dreampuf
dreampuf / chicken_soup.ipynb
Last active Nov 19, 2019
Greasy Chiken Soup
View chicken_soup.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.