Skip to content

Instantly share code, notes, and snippets.

View Stannislav's full-sized avatar
🦅

Stanislav Schmidt Stannislav

🦅
  • Expedia Group
  • Geneva, Switzerland
View GitHub Profile
@Stannislav
Stannislav / add-pyspark.sh
Last active June 30, 2022 13:39
Make pyspark available in the current virtual environment
#!/usr/bin/env bash
set -e
site_dir=$(python -c 'import site; print(site.getsitepackages()[0])')
if [[ "$site_dir" != *"venv"* ]]
then
echo "You don't seem to be running in a python venv."
echo "Refusing to modify the global python installation."
@Stannislav
Stannislav / .gitconfig
Created June 30, 2022 07:07
Gitconfig with nice git log aliases
[init]
defaultBranch = main
[alias]
l = log --graph --all --abbrev-commit --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(green)%ar %C(yellow)%an%C(bold yellow)%d%C(reset)%n %C(white)%s%n' --since=48.months
lol = log --oneline --graph
lola = log --oneline --graph --all
from __future__ import annotations
import os
import pathlib
import subprocess
import sys
def load_theme_paths() -> list[pathlib.Path]:
zsh_home = os.getenv("ZSH")
@Stannislav
Stannislav / logging_pseudocode.py
Last active August 9, 2022 09:05
Logging in Python - Pseudocode
"""Pseudocode for how logging works.
The logic taken directly from the standard library's implementation
in `logging/__init__.py`.
Only important aspects of the implementation were picked out for
clarity. To get all details check the docs [1] and the source
code [2].
Interesting observations:
/*
This has been tested on a Mac
Tools -> Build System -> New Build System...
Then save in ~/Library/Application Support/Sublime Text 3/Packages/User/asciidoc.sublime-build
*/
{
"cmd": ["asciidoctor", "$file"],
"selector": ["text.html.asciidoc","text.asciidoc"]
}
import csv
tutorial_date = "10 Oct 16"
# This is the student list obtained from Black Board
fin_student_list = "../master_bb_10.10.16.csv"
# This is the column in the Black Board list in which the student ID is found (first column = 0)
fin_student_list_id_col = 3
# This is the attendance list form astroattned
fin_attendance = "Quantum Physics Workshop - 10 Oct 16 1000.csv"
# This is the column in the astroattend file in which the student ID is found (first column = 0)
%
% INCLUDES
%
\RequirePackage[l2tabu, orthodox]{nag} % Issues warnings if deprecated packages are used
\documentclass[10pt]{beamer}
\usepackage{mathtools,amsfonts,amssymb}
\usepackage{parskip}
\usepackage{xcolor}
% \usepackage[hyphens]{url}

Keybase proof

I hereby claim:

  • I am Stannislav on github.
  • I am stanislav (https://keybase.io/stanislav) on keybase.
  • I have a public key whose fingerprint is D075 91D5 9429 9525 3860 A455 DA02 0AFD A096 F8D5

To claim this, I am signing this object:

@Stannislav
Stannislav / flocking.py
Last active August 29, 2015 14:27 — forked from harpolea/flocking.py
flocking simulation done for the Southampton Code Dojo on 13/8/15
import numpy as np
import matplotlib.pyplot as plt
import time
class Bird:
def __init__(self, position, direction):
self.xpos = position[0]
self.ypos = position[1]
self.xdir, self.ydir = direction
@Stannislav
Stannislav / wiki_line_width.js
Last active March 14, 2021 20:19
Greasemonkey script for wikipedia line width
// ==UserScript==
// @name Wiki line width
// @namespace https://www.github.com/Stannislav
// @description Narrow line length wikipedia
// @include http*://*wikipedia.org*
// @grant none
// ==/UserScript==
// Define the new width
const width = 50;