Skip to content

Instantly share code, notes, and snippets.

View seandlg's full-sized avatar
🎭
Day and night

Sean seandlg

🎭
Day and night
  • Berlin, Germany
View GitHub Profile
import random
# Set the following arguments
noSimulations = 100000
# The following graph is saved in the dictionary "graph"
#
# A--B--C--D
# | | | |
# E--F--G--H
@seandlg
seandlg / dkbcc.py
Last active March 24, 2019 19:39
Script to modify .csv Credit Card Transactions of DKB for use with GNUCash
import re, sys, os
if __name__ == '__main__':
filePath = os.path.abspath(sys.argv[1])
print("Reading %s"%str(filePath))
with open(filePath, 'r', errors='ignore') as f:
data = f.read()
print(data)
with open(filePath, 'w') as f:
label WHILE_EXP0
push local 0
push local 1
lt
push constant 1
add
not
if-goto WHILE_END0
let counter = 0;
let bound = 10;
while (counter < bound + 1) {
let counter = counter + 1);
}
do Output.printInt(counter);
@seandlg
seandlg / imagedownloader.py
Created September 1, 2019 10:09
A small script that downloads flat images from openrent.co.uk
# begin by executing: "scrapy shell {link to flat}"
# scrapy exposes a response object that is used in the
# in the following few lines of code. Run the lines
# individually or simply execute the script by running
# "exec(open('imagedownloader.py').read())" in the
# scrapy shell.
import urllib.request
divs = response.css('div')
@seandlg
seandlg / bashrc-extensions
Last active April 30, 2020 12:16
Bash extensions (add to .bashrc)
# Use "open" to open file explorer
alias open="nautilus ."
# Update system (use with care)
alias update="sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y"
# Always use always with sudo
alias apt="sudo apt"
# Reverse search bash history (better than CTRL+R imo) - outputs all results to STDOUT
@seandlg
seandlg / vimrc
Created December 2, 2019 11:51
Vim Configuration (etc/vim/vimrc)
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
@seandlg
seandlg / .tmux.conf
Created December 8, 2019 19:44
Practical Tmus Configuration (~/.tmux.conf)
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
@seandlg
seandlg / settings.json
Created July 9, 2020 03:19
VSCode settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"window.zoomLevel": 0,
"workbench.startupEditor": "newUntitledFile",
"eslint.validate": [
"vue",
@seandlg
seandlg / spawnAlacritty.bash
Last active December 8, 2020 23:52
Spawn Alacritty instance with the same cwd as the currently focused Alacritty instance (if there is one). Built for swaywm.
#!/usr/bin/env bash
# Check that jq and swaymsg are installed
if ! command -v jq &> /dev/null || ! command -v swaymsg &> /dev/null; then
echo "jq and swaymsg are required for this script to work!"
exit 1
fi
# Get the app_id of the currently focused window
APP=$(swaymsg -t get_tree | jq -r '.. | select(.focused == true)? | .app_id')