Skip to content

Instantly share code, notes, and snippets.

Python is my love affair

Peter Bittner bittner

Python is my love affair
View GitHub Profile
bittner /
Created Feb 28, 2019
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

bittner /
Last active Dec 11, 2021
Cross-OS compatibility with GNU tools (readlink, sed, zcat, zless, zdiff, ...) for Mac OS X towards Linux
# DESCRIPTION OF PROBLEM: Implementations of sed, readlink, zcat, etc. are different on OS X and Linux.
# NOTE: Put this on top of your script using sed, readlink, zcat, etc. that should work alike on Mac OS X.
# cross-OS compatibility (greadlink, gsed, zcat are GNU implementations for OS X)
[[ `uname` == 'Darwin' ]] && {
which greadlink gsed gzcat > /dev/null && {
unalias readlink sed zcat
alias readlink=greadlink sed=gsed zcat=gzcat
} || {
echo 'ERROR: GNU utils required for Mac. You may use homebrew to install them: brew install coreutils gnu-sed'
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on
# Some column types are not handled (e.g blobs).
# See also:
# -
# -
bittner / 60-jetbrains.conf
Created Sep 25, 2015
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/60-jetbrains.conf`
View 60-jetbrains.conf
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run `sudo service procps start` or reboot.
# Source:
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
bittner /
Last active Mar 5, 2021
How can I access my Ubuntu phone over ssh? (no `adb shell` required)
# GNU GPL v3 license, (c) 2016 by Alexander Kinne, Peter Bittner
IP_ADDRESS=$(ip addr show primary | grep wlan | grep 'inet ' | sed -e 's/^\s*inet //' -e 's/ brd .*$//' -e 's#/.*##')
echo "Your IP address: $IP_ADDRESS (wlan)"
if [[ "$(android-gadget-service status ssh)" == "ssh enabled" ]]; then
sudo android-gadget-service disable ssh
bittner / django-csrftoken-login-demo.bash
Last active Jun 11, 2020
Login and perform actions in a Django site (now with less security issues)
View django-csrftoken-login-demo.bash
# source this code in a Bash shell ($ . django-csrftoken-login-demo.bash),
# and run with a DB name as parameter (e.g. $ django-csrftoken-login-demo demo)
django-csrftoken-login-demo() {
local HOSTING_PANEL_USER='customer@email.address'
local HOSTING_PANEL_PASS='my secret login password'
local HOSTING_DB_PREFIX='username_'
bittner / .bash_aliases
Created Jul 9, 2015
.bash_aliases for Mac
View .bash_aliases
# .bash_aliases
# Source:
# enables color in the terminal bash shell
export CLICOLOR=1
# sets up the color scheme for list
export LSCOLORS=gxfxcxdxbxegedabagacad
# enables color for iTerm
export TERM=xterm-color
# Color Prompt
bittner /
Created Nov 1, 2019 verification

Keybase proof

I hereby claim:

  • I am bittner on github.
  • I am bittner ( on keybase.
  • I have a public key whose fingerprint is CEB6 EFC4 4BE0 2067 3E0A 7992 A16B A033 C916 661F

To claim this, I am signing this object:

bittner / about.html
Last active Oct 9, 2019
Mein erstes HTML Projekt
View about.html
<!DOCTYPE html>
<html lang="de">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Über das Projekt</title>
<link rel="stylesheet" href="" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
bittner / check-CRLF.bash
Created Nov 5, 2017
Check files for DOS/Windows line endings.
View check-CRLF.bash
#!/usr/bin/env bash
# -----------
# Check files for DOS/Windows line endings.
# -----------
[ -a "$1" ] || {
echo 'Check files for DOS/Windows line endings.'
echo "Usage: ${0##*/} {filename}"
exit 0
which dos2unix > /dev/null || {