Skip to content

Instantly share code, notes, and snippets.

Ivan Feofanov Ivan-Feofanov

Block or report user

Report or block Ivan-Feofanov

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
View upgrade-postgres-dokke.sh
#!/usr/bin/env bash
set -ex
SERVICE_NAME="resident-cabinet-back"
OLD_NAME="resident-cabinet-back"
NEW_NAME="resident-cabinet-back-new"
DATA_DIR="/var/lib/dokku/services/postgres/$NEW_NAME/data/"
POSTGRES_IMAGE="mdillon/postgis" POSTGRES_IMAGE_VERSION="11" dokku postgres:create $NEW_NAME
View remove non-digits.go
package main
import (
"fmt"
"regexp"
)
func main(){
phone := "+1 (567) 222-55-44"
reg := regexp.MustCompile(`\D`)
@Ivan-Feofanov
Ivan-Feofanov / postgres-backup.sh
Created Oct 30, 2018
backup postgres db in kubernetes
View postgres-backup.sh
DB_NAME=$1
NAMESPACE=$@
POD=$(kubectl -n="$NAMESPACE" get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' --selector=app=postgres)
kubectl -n="$NS" exec "$POD" pg_dump -Fc --no-acl --no-owner -h localhost -U postgres -w "$DB_NAME"
@Ivan-Feofanov
Ivan-Feofanov / reload-deployment.sh
Created Oct 30, 2018
reload kubernetes deployment
View reload-deployment.sh
DEPLOYMENT=$1
kubectl patch deployment $DEPLOYMENT -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
@Ivan-Feofanov
Ivan-Feofanov / getMethods.js
Last active Mar 12, 2019
Get list of association methods of model in Sequelize
View getMethods.js
const model = %yourSequelizeModel%
for (let assoc of Object.keys(model.associations)) {
for (let accessor of Object.keys(model.associations[assoc].accessors)) {
console.log(model.name + '.' + model.associations[assoc].accessors[accessor]+'()');
}
}
You can’t perform that action at this time.