Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandro Braun theRealSuperMario

View GitHub Profile
@theRealSuperMario
theRealSuperMario / iterm.py
Created Apr 4, 2021
Run a command in a new iTerm tab
View iterm.py
#!/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)
@theRealSuperMario
theRealSuperMario / iterm.bash
Created Apr 4, 2021 — forked from geyang/iterm.bash
bash function for opening up iterm form current directory
View iterm.bash
#!/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 / tps-demo.py
Created Jul 30, 2020 — forked from bgshih/tps-demo.py
A simple example of Thin Plate Spline (TPS) transformation in Numpy.
View tps-demo.py
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]
View Firing up LaTex on macOS.md

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

View 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]
View torch_gather_nd
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 / notes.md
Created Feb 21, 2020
Download unaligned celeba (in the wild) in .tgz archive which is significantly faster to extract than .7z
View notes.md
@theRealSuperMario
theRealSuperMario / example_image_utils.py
Created Jul 10, 2019 — forked from turicas/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
View example_image_utils.py
#!/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 / canidates_03.02.ipynb
Last active Feb 3, 2018
red-green friendly linestyles
View canidates_03.02.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View AbrechnungsKlasse.py
__author__ = 'sandro'
from tkinter import *
import functools
import sqlite3
from AusgabenBenutzer import *
import datetime
import time
class AbrechnungsKlasse: