Skip to content

Instantly share code, notes, and snippets.

View danielpodrazka's full-sized avatar
🏠
Working from home

Daniel Podrażka danielpodrazka

🏠
Working from home
View GitHub Profile
@danielpodrazka
danielpodrazka / generate_tokens.sh
Created March 11, 2024 13:29
Generate temporary AWS access tokens
aws sts get-session-token --duration-seconds 900 --output text | awk '{print "export AWS_ACCESS_KEY_ID="$2"\nexport AWS_SECRET_ACCESS_KEY="$4"\nexport AWS_SESSION_TOKEN="$5}'
@danielpodrazka
danielpodrazka / psycho.sh
Created December 30, 2023 07:56
Automatically compile psycopg
#!/bin/bash
# Update and Upgrade the System
sudo apt-get update
sudo apt-get upgrade -y
# Determine the installed Python version (major.minor)
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
# Install the corresponding version of python3.x-dev along with other necessary packages
@danielpodrazka
danielpodrazka / files2clipboard.sh
Created March 28, 2023 22:36
Bash one-liner that reads content of the files in current directory with their respective filename on top of each file and saves them in clipboard. Skips directories.
# sudo apt-get install xclip
for file in *; do if [ -f "$file" ]; then echo "=============$file============="; cat "$file"; echo; fi; done | xclip -selection clipboard
@danielpodrazka
danielpodrazka / cache_pandas.py
Last active December 22, 2022 16:15
Store the file below in your project and import it to the script that you are currently working on. I wrote an article about this gist: https://medium.com/@daniep/speed-up-developing-python-etls-with-invisible-cache-eb2eaadf6918
import os
import pandas as pd
from diskcache import FanoutCache
from diskcache.core import ENOVAL, args_to_key, ft, full_name
class cconnect(object):
def __init__(self):
self.begin = self.__enter__