Skip to content

Instantly share code, notes, and snippets.

View eenchev's full-sized avatar

Evgeni Enchev eenchev

View GitHub Profile
@eenchev
eenchev / kingroon_kp3s_gcode.txt
Created January 17, 2022 18:10
Kingroon KP3S GCode for Cura
Start G-code:
; KP3S Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X20 Y2.1 Z0.3 F5000.0 ; Move to start position
G1 X150 Y2.1 Z0.3 F1500.0 E15 ; Draw the first line
G1 X150 Y2.4 Z0.3 F5000.0 ; Move to side a little
Create VM:
gcloud compute instances create network-experiments-vm \
--machine-type=e2-small --subnet=default --zone=europe-west3-a --tags=playground-vm \
--image=ubuntu-minimal-2110-impish-v20211014 --image-project=ubuntu-os-cloud --boot-disk-size=100GB
@eenchev
eenchev / razer_blade_stealth_ubuntu.sh
Created June 5, 2021 14:56
Razer Blade Stealth 2016 battery state refresh on Ubuntu
#!/bin/bash
while sleep 15; do
busctl call --system org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.UPower.Device Refresh
done
@eenchev
eenchev / cloud_sql_export.md
Created March 27, 2020 07:08
Export Google Cloud SQL to bucket

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 February 26, 2020 09:28
Run Postgresql in Docker with persistent data

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
#!/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 October 27, 2019 17:22
Demonstration of Python threading library, specifically threading.Event class
#!/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()
rsync -chavzP --stats [email protected]:/remotefolderstobackup --exclude=/proc --exclude=/sys --exclude=/dev ./localfoldertobackupto
0x009Bb095BaBe6D29d3d2BCE93DF01dC5AB024531
0x004f9d9EdEbbe4E1a191a84c6D7f1667654F8aD9