Skip to content

Instantly share code, notes, and snippets.

View theRealSuperMario's full-sized avatar

Sandro Braun theRealSuperMario

View GitHub Profile
@theRealSuperMario
theRealSuperMario / AbrechnungsKlasse.py
Last active August 29, 2015 14:07
für abrechnungen
__author__ = 'sandro'
from tkinter import *
import functools
import sqlite3
from AusgabenBenutzer import *
import datetime
import time
class AbrechnungsKlasse:
@theRealSuperMario
theRealSuperMario / canidates_03.02.ipynb
Last active February 3, 2018 19:43
red-green friendly linestyles
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@theRealSuperMario
theRealSuperMario / example_image_utils.py
Created July 10, 2019 08:36 — forked from turicas/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@theRealSuperMario
theRealSuperMario / notes.md
Created February 21, 2020 14:16
Download unaligned celeba (in the wild) in .tgz archive which is significantly faster to extract than .7z
def torch_gather_nd(params, indices, params_shape, indices_shape):
"""dirty wrapper for tf.gather_nd to use with pytorch.
You will need https://github.com/theRealSuperMario/tfpyth for this.
"""
warnings.warn("Implemted using tfpyth, thus tensorflow is called in the back")
def func(params, indices):
return tf.gather_nd(params, indices)
out = tfpyth.wrap_torch_from_tensorflow(
@theRealSuperMario
theRealSuperMario / style.conf
Created June 29, 2020 17:45
zim style.conf
## /home/sandro/.config/zim
[TextView]
indent=30
tabs=None
linespacing=3
font=Lato 13
justify=
bullet_icon_size=GTK_ICON_SIZE_MENU
[Tag strong]

Firing up LaTex on macOS 🔥

As I'm writing this small tutorial, I assume you've read my previous one about setting up macOS, so if for any tool I'll use without explanation, look to that other article.

MacTex

The full version IS NOT MANDATORY, as in the tutorial that follows I installed the smaller version of MacTeX and proceded installing every needed dependency. Installing the complete package is about ~3.5GB of download and ~5GB on disk, the smaller one is just about 80MBs.

Click here to download the complete version or here to download the smaller version.

Gnuplot

@theRealSuperMario
theRealSuperMario / tps-demo.py
Created July 30, 2020 15:43 — forked from bgshih/tps-demo.py
A simple example of Thin Plate Spline (TPS) transformation in Numpy.
import ipdb
import numpy as np
import numpy.linalg as nl
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist, cdist, squareform
def makeT(cp):
# cp: [K x 2] control points
# T: [(K+3) x (K+3)]
K = cp.shape[0]
@theRealSuperMario
theRealSuperMario / iterm.bash
Created April 4, 2021 10:44 — forked from geyang/iterm.bash
bash function for opening up iterm form current directory
#!/usr/bin/env bash
#
# Open new iTerm window from the command line using v3 syntax for applescript as needed in iTerm2 Version 3+
# This script blocks until the cmd is executed in the new iTerm2 window. It then leaves the window open.
# TODO Add option to close iTerm2 after cmd execs
# See also https://www.iterm2.com/documentation-scripting.html
#
# Usage:
@theRealSuperMario
theRealSuperMario / iterm.py
Created April 4, 2021 13:47
Run a command in a new iTerm tab
#!/usr/bin/env python3
import iterm2
import AppKit
import click
import os
@click.command()
@click.argument(
"cwd", type=click.Path(exists=True, file_okay=False, dir_okay=True)