Skip to content

Instantly share code, notes, and snippets.

View philipp-zettl's full-sized avatar
:fishsticks:
<- Do you like fishsticks? https://tinyurl.com/fish-sticks

philipp-zettl

:fishsticks:
<- Do you like fishsticks? https://tinyurl.com/fish-sticks
View GitHub Profile
@philipp-zettl
philipp-zettl / k8s_setup.sh
Created July 25, 2024 09:02
Kubernetes setup
# install prerequisites
sudo pacman -S k9s terraform helm aws-cli kubectl
# install tgenv (terragrunt version manager)
git clone https://github.com/cunymatthieu/tgenv.git ~/.tgenv
echo 'export PATH="$HOME/.tgenv/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
tgenv install 0.58.2
tgenv use 0.58.2
@philipp-zettl
philipp-zettl / README.md
Created March 3, 2023 17:14
Download e-books from HumbleBundle.

Download helper for Humble-Bundle purchases

The other day I wanted to backup my e-books I purchased on Humble-Bundle. You can use the script below to backup your e-books as well!

Follow these steps:

  1. Log into your huble-bundle account
  2. visit https://www.humblebundle.com/home/library
  3. open the network tabs and look out for a request to https://www.humblebundle.com/api/v1/orders?all_tpkds=true
  4. save the response in a file on your local disk, e.g. ~/Downloads/bundles.json
  5. run the script
@philipp-zettl
philipp-zettl / install.sh
Last active February 4, 2025 08:19
Install python version. Installs global interpreter in `/opt/python/{PYTHON_VERSION}/bin/python`
#!/usr/bin/env bash
PYTHON_VERSION=${PYTHON_VERSION:-3.10.14}
CUR_DIR="$(pwd)"
TEMP_DIR="$(mktemp -d)"
cd "${TEMP_DIR}"
git clone https://github.com/python/cpython .
@philipp-zettl
philipp-zettl / Code.gs
Created December 11, 2022 17:03
GDS MongoDB Connector
/**
* Proxy API methods to search and retrieve MongoDB collections and their schemas
*/
function search(request){
// Make a POST request with form data.
var formData = {
'uri': request.connection,
'db_name': request.database,
'collection_name': request.collection,
@philipp-zettl
philipp-zettl / server.go
Created November 4, 2022 17:10
Reverse Proxy implementation in go, with struct holding request-response pairs for simple logging
package main
import (
"bytes"
"log"
"io/ioutil"
"net/url"
"net/http"
"net/http/httputil"
@philipp-zettl
philipp-zettl / activate_env.sh
Created October 26, 2022 15:40
Poetry activate env for current project
#!/bin/bash
source $(poetry env info | grep "$(poetry env list | awk '{print $1}')" | head -1 | awk '{print $2}')/bin/activate
@philipp-zettl
philipp-zettl / README.md
Created July 20, 2022 08:47
Backend simplified docker setup

Sometimes one wants to execute several commands in a docker container.
To fix the issue with searching for the right container name, proper paths and to prevent running several instances of a container on a single machine. I created a workflow to solve this issue.

The idea is simple, we create a bash script which handles 3 things for us

  1. verify that docker is running
  2. search for container name
  3. run a provided command in an interactive tty

To use this approach company-wide one needs to introduce fixed structure or adjust the script on each machine.
Disclaimer: tested under arch linux, no clue how to handle situations without systemctl as well as absence of commands like awk or docker-compose might cause trouble.

@philipp-zettl
philipp-zettl / README.md
Created July 29, 2021 16:41
Django Migration 2.2 -> 3.2

Django

Deprecations:

3.0

  • dropped support for postgres <= 9.4
  • django.db.backends.postgresql_psycopg2 now called django.db.backends.postgres
  • field_name keyword argument of QuerySet.earliest() and latest() is removed

3.1

  • django.contrib.postgres.fields.JSONField and django.contrib.postgres.forms.JSONField are deprecated in favor of models.JSONField and forms.JSONField.
  • A model’s Meta.ordering doesn’t affect GROUP BY queries.
@philipp-zettl
philipp-zettl / mysql-docker.sh
Created July 13, 2019 15:05 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@philipp-zettl
philipp-zettl / markdown collapsible
Created January 30, 2019 09:57
collapsible for markdown (actually just HTML)
## collapsible markdown?
<details><summary>CLICK ME</summary>
<p>
#### yes, even hidden code blocks!
```python
print("hello world!")
```