Skip to content

Instantly share code, notes, and snippets.


Fábio Fortkamp fabiofortkamp

View GitHub Profile
fabiofortkamp / latex-problem-set.tex
Created Oct 8, 2020
LaTeX template for college problem sets
View latex-problem-set.tex
%% see
%% I honestly cannot remember where I got this from
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
fabiofortkamp / ST1GEE1.bunch
Created Mar 23, 2020
Example bunch file that I use to prepare classes (file names are in Portuguese)
View ST1GEE1.bunch
# Comments start with a hash symbol, blank lines are ignored
# Use @@ to hide all visible apps. Usually used at the top of the file
# before launching the rest of the bunch
# Include a line starting with a dash to open specific
# files in the app
# If the first file listed is "XX", all open windows
# for the app will be closed first
# function to close the buffer corresponding to a given file in emacs
# cf = close file
function cf() {
emacs -e "(if (get-buffer \"$1\") (kill-buffer \"$1\"))"
fabiofortkamp /
Created Oct 23, 2019
Definiing custom exceptions in Python with a meaningful message
class InvalidParameterError(ValueError):
fabiofortkamp /
Created Oct 7, 2019
How to calculate radial remanence directions
import numpy as np
# example input parameters
phi_S_IV = 50
# how much each segment occupies of the whole magnet region
fractions_phi = np.array([20,20,20,20,20])
assert sum(fractions_phi) == 100
fabiofortkamp /
Last active Sep 25, 2019
Example prm stop script for my "paper" project, on Windows
# Sincroniza de volta mudanças feitas
git push origin
# ver explicações abaixo para esses comandos
cf PaperMagneticProfiles_JBSMSE.tex
closew "paper-magnetic-profiles - Visual Studio Code"
closew "Sourcetree"
closew "Outline_Paper_Profiles"
fabiofortkamp /
Last active Sep 25, 2019
Example prm start script to work on a paper, on Windows
cd $HOME/latex-writing/paper-magnetic-profiles/
# sync repo
git pull origin master
# open Visual Studio Code to edit and run scripts
code -n .
# Sourcetree is a Git client
fabiofortkamp / closewindows.ahk
Created Sep 25, 2019
AutoHotKey script to close window whose name is passed on as argument
View closewindows.ahk
; This script closes the window name passed as argument, e.g.
; AutoHotkey.exe closewindow.ahk "Visual Studio Code"
; To match strings anywhere in the window title
SetTitleMatchMode 2
If (WinExist(A_Args[1]))
function closeapp() {
osascript -e "quit app \"$1\""
fabiofortkamp /
Created Jul 12, 2017
Common matplotlib configuration, with LaTeX and my own packages, for easier generation of engineering plots
import matplotlib
import matplotlib.pyplot as plt
mpl_params = {'text.usetex': True,
'': 'serif',
'font.serif': 'Palatino',
'text.latex.preamble': [r'\usepackage{engsymbols}',