Skip to content

Instantly share code, notes, and snippets.

@1kastner
1kastner / install_conda.bat
Last active May 21, 2021 — forked from nimaid/install_conda.bat
Batch script to install Miniconda on WIndows without user input
View install_conda.bat
@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 / export_pdfs_from_pptx.py
Created May 21, 2021
Export a set of PPTX files as a single PDF
View export_pdfs_from_pptx.py
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 / pyproject.toml
Last active Mar 16, 2021
poetry project definition
View pyproject.toml
[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"
View remove-all-from-docker.sh
# 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
@1kastner
1kastner / docker-cleanup-resources.md
Created Mar 25, 2020 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
View example_folium_archiving.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@1kastner
1kastner / README.md
Created Sep 19, 2018 — forked from obscurerichard/README.md
Simulates a low bandwidth, high-latency network connection
View README.md

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency
slow dsl -b 1mbps         # Simulate DSL with a slower speed than the default
slow modem-56k -d eth0    # Simulate a 56k modem on the eth1 device. eth0 is unchanged.
View map matching with jupyter.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View linuxify
linuxify() {
windowspath=$1
temppath="$(echo $windowspath | sed -E 's/([A-Z]):/\/mnt\/\L\1/g')" # C: -> /mnt/c, E: -> /mnt/e
temppath="$(echo $temppath | sed 's/\\/\//g')" # backslash -> forward slash
linuxpath=$temppath
echo $linuxpath
}
@1kastner
1kastner / reflect.py
Last active Jun 3, 2021 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
View reflect.py
#!/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):