Skip to content

Instantly share code, notes, and snippets.

View Drvanon's full-sized avatar
😀
Ready to get working

Robin Alexander Dorstijn Drvanon

😀
Ready to get working
  • Groningen
View GitHub Profile
version: '3.4'
services:
db:
restart: always
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: root # TODO: Change this to something more secure on actual server!
def for_each(iterable, function):
running = True
while running:
try:
a = next(iterable)
function(a)
except StopIteration:
running = False
def length(array):
@Drvanon
Drvanon / .vimrc
Last active March 22, 2019 16:20
let mapleader =","
call plug#begin('~/.config/nvim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'junegunn/goyo.vim'
Plug 'tpope/vim-commentary'
Plug 'Townk/vim-autoclose'
Plug 'tpope/vim-surround'
#!/bin/bash
stty -ixon # Disable ctrl-s and ctrl-q.
shopt -s autocd #Allows you to cd into directory merely by typing the directory name.
HISTSIZE= HISTFILESIZE= # Infinite history.
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases
# System Maintainence
alias mw="~/.config/mutt/mutt-wizard.sh"
@Drvanon
Drvanon / pysed
Created March 13, 2019 22:29
Simple script to act as a sed with python regex
#! /usr/bin/env python
# credit for the function to https://stackoverflow.com/a/40843600
# Commandline-ification by Robin A. Dorstijn
import re
import shutil
from tempfile import mkstemp
import click
@click.command()
@Drvanon
Drvanon / v4.py
Last active March 4, 2019 23:18
Self referential many to many relationship with extended data, containing foreign key
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.orm import relationship, mapper, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.associationproxy import association_proxy
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
@Drvanon
Drvanon / __init__.py
Last active June 8, 2019 12:20
Flask Context Problem
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__ )
app.config.from_mapping( SECRET_KEY='12398fjnkcm,zxcjnd123n')
from . import auth
app.register_blueprint(auth.bp)
#include <DRV8825.h>
#include <HX711.h>
HX711 scale;
#define CAL_VAL 385 // Set the calibration value
#define DOUT A1 // DOUT -> pin A1 on arduino
#define SCK A0 // SCK -> pin A0 on arduino
#define STEP_SIZE 10 // Set the step size in milimeter
Als haar adem plaats maakt voor de scherpe wind, stapt zij uit reflex naar achteren om zich te beschermen tegen de kou die de trein met zich meebrengt.
Ze zucht en slentert naar het rokershokje.
Ze rookt niet, maar het is overdekt en op een jongeman na is de ruimte leeg.
Dat verbaast haar niet, gezien het tijdstip. Als de piepende deur achter haar dichtvalt, kijkt de jongeman schichtig op.
Ze groeten elkaar en de jongen steekt een nieuwe sigaret op.
Zij sluit haar ogen en luistert naar het getrommel van de regen op het dak.
"Waarom doe je dat?"
"Wat doe ik?"
"Je hebt je ogen dicht."
"Ik luister naar de regen. Dat vind ik rustgevend."
@Drvanon
Drvanon / mine.cpp
Last active August 29, 2015 14:08 — forked from anonymous/mine.cpp
#include <EEPROM.h>
float tempC;
int reading;
int tempPin = 0;
int EAdress = 0;
void setup () {
analogReference(INTERNAL);
}