Skip to content

Instantly share code, notes, and snippets.

View SimonMayerhofer's full-sized avatar
🕶️
'sup?

Simon Mayerhofer SimonMayerhofer

🕶️
'sup?
View GitHub Profile
@SimonMayerhofer
SimonMayerhofer / german_typos_wikipedia_to_alfred_snippets.py
Last active January 14, 2018 18:01
Script to parse the Wikipedia pages for common german typos and convert them to Alfred Snippets. See: https://de.wikipedia.org/wiki/Wikipedia:Liste_von_Tippfehlern
# !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Script to parse the Wikipedia pages for common german typos and convert them
to Alfred Snippets.
See: https://de.wikipedia.org/wiki/Wikipedia:Liste_von_Tippfehlern
'''
@SimonMayerhofer
SimonMayerhofer / functions.php
Created May 5, 2018 08:49
Disable saving of the IP address in WordPress comments
function my_remove_commentsip( $comment_author_ip ) {
return '';
}
add_filter( 'pre_comment_user_ip', 'my_remove_commentsip' );
@SimonMayerhofer
SimonMayerhofer / pdf-download-sc.php
Last active December 14, 2018 18:40
PDF Download Element WordPress Shortcode - see it in action here: https://codepen.io/maysi/pen/aPNZbV
<?php
/**
* Adds shortcode for PDF download element.
*
* @package your-package.
*/
/**
* Add shortcode function for PDF download element.
* [pdf_download name="Aktuelle Produktinformationen" label="PDF DOWNLOAD" link="#"].
@SimonMayerhofer
SimonMayerhofer / History|-1035d003|entries.json
Last active May 15, 2023 16:42
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/simon/Repos/breitinger/dist/assets/images/logo.svg","entries":[{"id":"BLHq.svg","timestamp":1667990537506}]}
@SimonMayerhofer
SimonMayerhofer / heyflow.js
Last active July 1, 2024 22:23
Useful Heyflow scripts
const disabledPrefixes = [];
window.Client = {
cookieConsentInitialized: false,
cookieConsentInit: function(screenName) {
if (this.cookieConsentInitialized) {
return;
}
@SimonMayerhofer
SimonMayerhofer / Fifo.gs
Created August 21, 2023 10:30 — forked from iassael/Fifo.gs
FIFO for Investments Inventory Accounting [Google Sheets - Apps Script]
/**
* Calculates the remaining inventory, current average buy price, total cost and total gains using FIFO (First In First Out) method.
* The function expects three parameters: transactionsType, transactionQuantities and transactionPrices sorted by date.
*
* Inspired by: https://www.allstacksdeveloper.com/2022/09/fifo-stock-portfolio-google-sheets.html
*
* @param {string[] | string} transactionsType - An array or a single string representing transaction types. Each string should be either 'B' for buy or 'S' for sell.
* @param {number[] | number} transactionQuantities - An array or a single number representing the quantities for each transaction.
* @param {number[] | number} transactionPrices - An array or a single number representing the prices for each transaction.
* @throws Will throw an error if transactionPrices and transactionQuantities are not arrays or if their lengths are not equal.
@SimonMayerhofer
SimonMayerhofer / redirect_log.py
Last active July 4, 2024 10:16
Python script to follow redirects and get final URL + route logging.
import requests
from urllib.parse import urlparse
import json
import traceback
import urllib3
# Suppress only the single InsecureRequestWarning from urllib3 needed
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def follow_redirects(url):