Skip to content

Instantly share code, notes, and snippets.

View DominikPeters's full-sized avatar

Dominik Peters DominikPeters

View GitHub Profile
@DominikPeters
DominikPeters / paris-annual-passes.md
Last active January 18, 2022 15:40
List of touristic annual pass offers in Paris / Ile-de-France

This is a list of annual memberships / annual passes that allow unlimited access to tourist attractions in Paris and Ile-de-France. Prices as of early 2022.

@DominikPeters
DominikPeters / input-search-dark-mode.css
Created December 20, 2021 21:54
Styling the ⤫ cancel button of input[type=search] for dark mode in Chrome and Safari
/* Makes the clear/cancel/delete button bright instead of dark when in dark mode */
@media (prefers-color-scheme: dark) {
input[type="search"]::-webkit-search-cancel-button {
filter: invert(1);
}
}
@DominikPeters
DominikPeters / lwarp-tips.md
Last active August 3, 2024 21:41
Some tips for using lwarp for Latex to HTML conversion

Replace natbib by biblatex to get citation links

\usepackage[backend=bibtex, style=authoryear-comp, natbib=true, sortcites=false]{biblatex}
\addbibresource{main.bib}

% optional if you want (Smith 1776) instead of (Smith, 1776)
\renewcommand*{\nameyeardelim}{\addspace}

\begin{document}
@DominikPeters
DominikPeters / close-chrome-incognito.applescript
Created December 4, 2021 15:13
AppleScript for closing all incognito windows of Google Chrome
tell application "Google Chrome"
set allWindows to get every window
repeat with i in allWindows
set windowProperties to properties of i
set windowMode to mode of windowProperties
if windowMode is "incognito" then
close i
end if
end repeat
end tell
@DominikPeters
DominikPeters / yt-dl.applescript
Created December 2, 2021 04:28
AppleScript to call youtube-dl on the URL currently displayed by Google Chrome
# I use this together with BetterTouchTool
tell application "Google Chrome"
set theURL to URL of active tab of first window as string
end tell
tell application "Terminal"
do script "cd ~/Downloads && youtube-dl '" & theURL & "'"
end tell
@DominikPeters
DominikPeters / cmt-block-filters.txt
Last active October 26, 2022 09:18
Adblocker filters to hide clutter in reviews, CMT for AAAI 2023
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div>div>strong
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(4)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(5)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(6)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(7)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(8)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(9)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(10)
cmt3.research.microsoft.com##div[data-bind="foreach: questions"]>div.row:nth-of-type(15)
cmt3.research.microsoft.com##div[data-bind="foreach:reviews"] > h2
@DominikPeters
DominikPeters / kemeny.py
Created August 29, 2020 23:23
Calculate Kemeny's rule using gurobipy
from gurobipy import *
import itertools
def better(vote, a, b):
return vote.index(a) < vote.index(b)
def kemeny(profile):
# a profile is a list of rankings, e.g. [(0,1,2),(1,2,0),(1,2,0)]
C = profile[0]
w = {}
@DominikPeters
DominikPeters / merge_insertion.py
Created August 27, 2020 12:52
Python implementation of the merge insertion sort algorithm
# Implementation of the Merge Insertion sort algorithm
# -- a sort algorithm that is efficient w.r.t. number of pairwise comparisons
# based on the description in
# https://en.wikipedia.org/w/index.php?title=Merge-insertion_sort&oldid=959884881
# This is not intended to be time- or space-efficient.
# "less" is a function such that less(x,y) is true iff x should go to the left of y
# Dominik Peters, August 2020
# imports only needed for test at the bottom
from __future__ import print_function
@DominikPeters
DominikPeters / __counterexamples_fair_division.txt
Last active March 8, 2024 07:02
Counterexamples in fair division
A collection of some counterexamples I've found for
fair allocation of indivisible goods, mostly via random sampling.
@DominikPeters
DominikPeters / nash_indivisible.py
Created April 29, 2020 04:01
Maximize Nash welfare for allocating indivisible goods
# Indivisible private goods, maximum Nash welfare
# Using Gurobi, this implements the ILP formulation from
# Caragiannis, Ioannis, et al.
# "The unreasonable fairness of maximum Nash welfare."
# ACM Transactions on Economics and Computation (TEAC) 7.3 (2019): 1-32.
from gurobipy import *
import math
import random