Skip to content

Instantly share code, notes, and snippets.

@mp4096
mp4096 / ppt2pdf.ps1
Created April 28, 2016 10:56
Batch convert PowerPoint files to PDF
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system.
# You can allow them by calling PowerShell as an Administrator and typing
# ```
# Set-ExecutionPolicy Unrestricted
@mp4096
mp4096 / word2pdf.ps1
Created March 31, 2016 08:42
Batch convert Word files to PDF
# Batch convert all .doc/.docx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system.
# You can allow them by calling PowerShell as an Administrator and typing
# ```
# Set-ExecutionPolicy Unrestricted
@mp4096
mp4096 / fortran-notes.md
Last active February 24, 2022 02:10
Notes on Fortran

Notes on Fortran

These are some initial impressions of Fortran 2008 as seen by a MATLAB person.

Very generally, I would say Fortran is quite similar to MATLAB (I know that it's actually the other way round). Apart from this, here are some language features that I found quite interesting/quirky/nice/annoying (in no particular order):

  • Implicit typing:
    • Implicit typing in Fortran has nothing to do with modern type inference (a-la auto in C++11)! If it is active, the compiler tries to assign types based on variable names. 😱 So it is really necessary to always use implicit none.
  • Array indexing:
    • Can be specified by the programmer, e.g. one can start indexing with 0 or even use negative indices. On the other hand: Prepare to memorise scenarios in which indices are remapped to 1:N by default and a couple of cases when indices remain the same.
    • MATLAB slices are specified as <lower bound> : <step size> : <upper bound>, whereas Fortran uses ` :
@mp4096
mp4096 / foobar.cpp
Last active May 17, 2020 14:15
Fun with lifetimes
#include <iostream>
#include <vector>
struct Foo {
float x;
float y;
float z;
};
using Bar = std::vector<float>;

Keybase proof

I hereby claim:

  • I am mp4096 on github.
  • I am mp4096 (https://keybase.io/mp4096) on keybase.
  • I have a public key whose fingerprint is 0639 BFEA 7F2A 577D D8F4 18F2 26F8 94EC B588 E873

To claim this, I am signing this object:

@mp4096
mp4096 / get_campusonline_appointments.py
Last active January 17, 2019 14:28
Batch export of CAMPUSonline appointments from courses matching a regex
from bs4 import BeautifulSoup
import re
import requests
# Global parameters: CAMPUSonline"s base URL and its export URL
CO_BASE_URL = "https://campus.tum.de/tumonline/"
CO_EXPORT_URL = "wbKalender.wbExport?pMode=T"
APPOINTMENTS_PREFIX = "^Termine der LV.*"
@mp4096
mp4096 / cartesian_product.hs
Created February 23, 2018 08:31
Cartesian product using folder
product xss = foldr f [[]] xss
where f xs yss = foldr g [] xs
where g x zss = foldr h zss yss
where h ys qss = (x : ys) : qss
@mp4096
mp4096 / jt.sh
Created November 15, 2017 13:21
Jupyter themes
# Activate dark theme
jt -t chesterish -f source -T
# Reset to default
jt -r
# Modify ~/.ipython/profile_default/startup/startup.ipy
#
# from jupyterthemes import jtplot
# jtplot.style()
@mp4096
mp4096 / thesis_kickoff_playbook.md
Last active October 25, 2017 12:45
Thesis kick-off playbook

Thesis kick-off playbook

Preparation

  • Print out:
    • Thesis task description
    • Grading table — not public anymore
    • Safety briefing
    • Relevant papers
  • Code of conduct
@mp4096
mp4096 / swatch.tex
Last active August 8, 2017 15:22
Nord swatch
\documentclass[10 pt, a4paper]{article}
% ======================================================================
% Use UTF-8 and T1
% ======================================================================
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
% ======================================================================