Skip to content

Instantly share code, notes, and snippets.

View evzpav's full-sized avatar

Evandro Pavei evzpav

View GitHub Profile
@evzpav
evzpav / go_create_dokku_config.sh
Last active March 31, 2019 19:46
Add all configs fo golang project to run on dokku. Create Procfile, up_dokku script, and add metadata to Gopkg.toml
#!/bin/bash
#run dep
if [ ! -f "Gopkg.toml" ]; then
echo "running go dep"
go get -u github.com/golang/dep/cmd/dep
dep init
dep ensure
fi
@evzpav
evzpav / django_create_dokku_config.sh
Last active March 31, 2019 19:46
Create dokku config enough for dokku deployment. Create requirements.txt, Procfile,
#!/bin/bash
PROJECT_NAME=dokku-django
VIRTUAL_ENV_PATH=venv
#install dependencies and add to requirements.txt
source $VIRTUAL_ENV_PATH/bin/activate
pip install gunicorn
pip install django-heroku
@evzpav
evzpav / spa_create_dokku_config.sh
Last active May 9, 2019 15:16
Script to be run on Single Page Application like Vue, Angular, React to deploy on dokku
#!/bin/bash
#create .static empty file
touch .static
# create deploy script
echo "
#!/bin/bash
rm -rf dist/*
npm run build
@evzpav
evzpav / gatsby_dokku_config.sh
Last active April 30, 2020 19:15
Config to run Gatsby on Dokku
#static.json on root project:
{
"root": "public/",
"headers": {
"/**": {
"Cache-Control": "public, max-age=0, must-revalidate"
},
"/**.css": {
"Cache-Control": "public, max-age=31536000, immutable"
},
#!/bin/bash
echo "-- STOPPING CONTAINERS"
docker stop $(docker ps -q)
echo "-- REMOVING CONTAINERS"
docker rm $(docker ps -q)
docker rm $(docker ps -a -q)
echo "-- REMOVING IMAGES"
@evzpav
evzpav / .gitlab-ci_dokku.yml
Last active March 23, 2023 18:33
Gitlab CI config for Dokku project
stages:
- deploy
variables:
APP_NAME: app-name
GIT_DEPTH: 0
deploy:
stage: deploy
image: ilyasemenov/gitlab-ci-git-push
@evzpav
evzpav / .gitlab-ci.yml
Last active June 17, 2021 14:23
Gitlab CI config to build and deploy SPA to S3
stages:
- build
- deploy
variables:
APP_NAME: upcoming-movies
GIT_DEPTH: 0
BUCKET_NAME: upcomingmovies
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
@evzpav
evzpav / measure_time.go
Created July 6, 2020 02:55
Measure function time to execute in Go
package main
import (
"fmt"
"time"
)
func measureTime(funcName string) func() {
start := time.Now()
package main
import (
"archive/zip"
"fmt"
"io/ioutil"
"os"
)
func main() {
@evzpav
evzpav / delete_stale_branches.sh
Created October 13, 2020 10:46
Delete stale local branches
#!/bin/bash
# Delete all local branches that are no "master" neither "develop"
git branch -D `git branch | grep -vE 'master|develop'`