Skip to content

Instantly share code, notes, and snippets.

View phdd's full-sized avatar

Peter phdd

View GitHub Profile
@phdd
phdd / BodyParser.php
Last active January 26, 2024 09:32
UD Media Mautic Bounce rule
<?php
namespace Mautic\EmailBundle\MonitoredEmail\Processor\Bounce;
use Mautic\EmailBundle\MonitoredEmail\Exception\BounceNotFound;
use Mautic\EmailBundle\MonitoredEmail\Message;
use Mautic\EmailBundle\MonitoredEmail\Processor\Bounce\Definition\Category;
use Mautic\EmailBundle\MonitoredEmail\Processor\Bounce\Definition\Type;
use Mautic\EmailBundle\MonitoredEmail\Processor\Bounce\Mapper\CategoryMapper;
@phdd
phdd / vscode-profiles.plugin.zsh
Created March 24, 2022 09:16
ZSH Plugin - Visual Studio Code Profiles
VSCODE_BIN=`which code`
code_with_profile() {
while true; do
case "$1" in
-p|--profile)
PROFILE_NAME="$2"
shift 2
;;
--)
@phdd
phdd / miniconda.plugin.zsh
Created March 24, 2022 08:36
ZSH Plugin for Lazy Loading Miniconda (Arch Linux) adopted from https://reddit.com/qmd25q
load_miniconda() {
unalias conda
__conda_setup="$('/opt/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/miniconda3/etc/profile.d/conda.sh" ]; then
. "/opt/miniconda3/etc/profile.d/conda.sh"
@phdd
phdd / toggl_to_hamster.py
Last active February 10, 2021 12:35 — forked from meunomemauricio/toggl_to_hamster.py
Script to Import a CSV file exported from Toggl.com to a Hamster DB
#! /usr/bin/python
"""Import CSV Files from Toggl to a Hamster DB."""
import argparse
import codecs
import csv
import sys
from datetime import datetime
@phdd
phdd / tasks.sql
Last active April 23, 2020 07:16
From planner-todo.web.app to todo.txt
select (case i.checked when 1 then 'x ' else '' end) || i.content
|| (case i.note when '' then '' else '\n' || replace(i.note, '
', '\n') end) || ' +' || replace(p.name, ' ', '')
|| (case when i.due_date != '' then ' due:' || substr(i.due_date, 0, 11) else '' end)
from Items as i
join Projects as p on i.project_id = p.id;
@phdd
phdd / README.md
Last active April 30, 2018 07:50
Google Calendar recurring Event hack

Google Calendar recurring events hack

There seems to be a synchronization issue on some Android devices. Any calendar app renders recurring events a couple hundred times. Pretty annoying, cause it gets slow as hell and my smartwatch constantly chokes on all the notifications. This little Python script transforms all recurring events within a two-year timespan to single event instances. Thus, it's hacky but it solves the issue.

Install

@phdd
phdd / revealjs.css
Created January 29, 2018 09:11
Reveal.js Custom Style
.reveal section img {
border: none;
}
@phdd
phdd / dropbox-owncloud-sync.js
Last active June 25, 2017 10:18
FaaS triggering OwnCloud reload on Dropbox change
'use latest';
import rp from 'request-promise';
import express from 'express';
import bodyParser from 'body-parser';
import { fromExpress } from 'webtask-tools';
const app = express();
app.use(bodyParser.json());
@phdd
phdd / pandoc-filter-include.py
Created June 9, 2017 13:57
Pandoc include filter
#!/usr/bin/env python
"""
Include contents from other files, even recursively.
Examples:
- Include first chaper from markdown file
[](chapter1.md){.include .markdown}
@phdd
phdd / watch.sh
Created June 9, 2017 13:57
Pandoc watch script
#!/bin/bash
FORMAT=$1
DOCUMENT=$2
livereload "$DOCUMENT.html" -d -w 200 &
LIVERELOAD=$!
http-server . &
HTTP_SERVER=$!