Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bittner's full-sized avatar
🐍
Python is my love affair

Peter Bittner bittner

🐍
Python is my love affair
View GitHub Profile
@bittner
bittner / about.html
Last active October 9, 2019 18:43
Mein erstes HTML Projekt
<!DOCTYPE html>
<html lang="de">
<head>
<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="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="container">
@bittner
bittner / keybase.md
Created November 1, 2019 17:06
Keybase.io verification

Keybase proof

I hereby claim:

  • I am bittner on github.
  • I am bittner (https://keybase.io/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
bittner / .bash_aliases
Created July 9, 2015 11:45
.bash_aliases for Mac
# .bash_aliases
# Source: http://techie-notebook.blogspot.ch/2012/04/making-your-terminal-look-pretty-on-mac.html
# 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
bittner / toggle-sshd.sh
Last active March 5, 2021 20:08
How can I access my Ubuntu phone over ssh? (no `adb shell` required)
#!/bin/bash
# GNU GPL v3 license, (c) 2016 by Alexander Kinne, Peter Bittner
# http://askubuntu.com/questions/601910/ssh-ubuntu-touch/653595#653595
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
else
@bittner
bittner / gnu-tools-for-mac.sh
Last active December 11, 2021 20:05
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'
@bittner
bittner / django-csrftoken-login-demo.bash
Last active August 15, 2022 23:45
Login and perform actions in a Django site (now with less security issues)
# 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() {
# -- CHANGE THESE VALUES TO MATCH YOUR ACCOUNT --
local HOSTING_USERID=9988
local HOSTING_PANEL_USER='customer@email.address'
local HOSTING_PANEL_PASS='my secret login password'
local HOSTING_DB_PREFIX='username_'
local DB_NAME=$HOSTING_DB_PREFIX$1
@bittner
bittner / 60-jetbrains.conf
Created September 25, 2015 07:57
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/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: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
#
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
@bittner
bittner / Doxyfile
Created January 18, 2023 23:12
Doxygen example configuration for Python projects. Generates call graphs, ignores test modules.
# Example Doxyfile for a Python (package) project.
#
# - Install Doxgen (e.g. via `sudo apt-get install doxygen`).
# - Run `doxgen` to generate HTML documentation in a `html/` subdirectory.
#
# Generates call graphs, picks up all modules recursively, ignores test modules.
# Docstrings are rendered in typewriter; this may be able to fix via the
# `doxypypy` Python module used as filter for `*.py`.
#
# Inspired by: (see for screenshots!)
@bittner
bittner / sqlite2pg.sh
Last active January 23, 2024 08:35 — forked from eclubb/sqlite2pg.sh
#!/bin/bash
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
#
# See also:
# - http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql
# - https://gist.github.com/bittner/7368128
@bittner
bittner / .bash_ohmyzsh
Last active March 14, 2024 13:18 — forked from chrisberkhout/.bash_profile
Git aliases taken from oh-my-zsh's git plugin and translated to bash (plus a few more aliases)
# git aliases - taken from oh-my-zsh's git plugin and translated to bash
# https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet#helpful-aliases-for-common-git-tasks
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
function git_current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
function git_current_repository() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \