Skip to content

Instantly share code, notes, and snippets.

@1kastner
1kastner / remove-all-from-docker.sh
Created March 25, 2020 15:29 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
import requests
import requests_mock
import requests_cache
with requests_mock.mock() as mock:
mock.get("mock://test", text="test")
requests_cache.install_cache("test_cache", backend="memory")
requests.get("mock://test")
# -> RecursionError: maximum recursion depth exceeded
@1kastner
1kastner / pyproject.toml
Last active March 16, 2021 07:28
poetry project definition
[tool.poetry]
name = "einfuehrung-in-jupyter-notebooks"
version = "0.1.0"
description = "Workshop material for 'Einführung in Jupyter Notebooks'"
authors = ["Marvin Kastner <marvin.kastner@tuhh.de>"]
[tool.poetry.dependencies]
python = "^3.8"
jupyterlab = "^3.0.10"
pandas = "^1.2.3"
@1kastner
1kastner / export_pdfs_from_pptx.py
Created May 21, 2021 18:11
Export a set of PPTX files as a single PDF
import os
import datetime
import comtypes.client
from PyPDF2 import PdfFileMerger
target_dir = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
os.pardir,
"data transfer"
))
@1kastner
1kastner / install_conda.bat
Last active May 21, 2021 20:30 — forked from nimaid/install_conda.bat
Batch script to install Miniconda on WIndows without user input
@echo off
set ORIGDIR="%CD%"
set MINICONDAPATH=%USERPROFILE%\Miniconda3
set CONDAINSTALLER=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%-condainstall.exe
set "OS="
set "MCLINK="
where conda >nul 2>nul
@1kastner
1kastner / run_python_script_in_conda_env.bat
Last active March 5, 2024 08:27 — forked from maximlt/run_python_script_in_conda_env.bat
Run a Python script in a conda environment from a batch file
@ECHO OFF
SETLOCAL EnableDelayedExpansion
REM Insert your conda env here
SET CONDA_ENV=MY_DESIRED_CONDA_ENV
CALL :activate_conda_env
REM Insert your python script here
@1kastner
1kastner / reflect.py
Last active April 3, 2024 13:52 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):