Skip to content

Instantly share code, notes, and snippets.

Avatar

Evgeni Enchev eenchev

View GitHub Profile
@eenchev
eenchev / cloud_sql_export.md
Created Mar 27, 2020
Export Google Cloud SQL to bucket
View cloud_sql_export.md

create a bucket if you don't have one, run

gsutil mb -p [PROJECT_NAME] -l [LOCATION_NAME] gs://[BUCKET_NAME] Describe the sql instance you are exporting from and copy the sa

gcloud sql instances describe [INSTANCE_NAME] Add the service account to the bucket ACL as a writer

gsutil acl ch -u [SERVICE_ACCOUNT_ADDRESS]:W gs://[BUCKET_NAME] Add the service account to the import file as a reader

@eenchev
eenchev / postgres_in_docker.md
Last active Feb 26, 2020
Run Postgresql in Docker with persistent data
View postgres_in_docker.md

Create a volume:

docker volume create VOLUME_NAME_PLACEHOLDER

Run the container, using that volume

docker run --name CONTAINER_NAME_PLACEHOLDER -it --rm \
            -e POSTGRES_PASSWORD=POSTGRES_USER_PASSWORD_PLACEHOLDER -p 5444:5432 \
            -v VOLUME_NAME_PLACEHOLDER:/var/lib/postgresql/data -d postgres
View Bash KeyValue storage
#!/bin/bash
#### Constants
USAGE="Usage: $(basename "$0") (-d/--database NAME) [GET/SET] [KEY-NAME] [VALUE] -- simple key-value storage implemented in bash"
DEFAULT_DB_NAME=0
#### Functions
print_usage() {
echo "$USAGE"
}
@eenchev
eenchev / threading_events.py
Created Oct 27, 2019
Demonstration of Python threading library, specifically threading.Event class
View threading_events.py
#!/usr/bin/python3
import threading
class FooBar:
def __init__(self, n):
self.n = n
self.fooCanRun = threading.Event()
self.barCanRun = threading.Event()
self.fooCanRun.set()
View Rsync backup over SSH
rsync -chavzP --stats user@x.x.x.x:/remotefolderstobackup --exclude=/proc --exclude=/sys --exclude=/dev ./localfoldertobackupto
View Kovan2
0x009Bb095BaBe6D29d3d2BCE93DF01dC5AB024531
View Kovan
0x004f9d9EdEbbe4E1a191a84c6D7f1667654F8aD9