Skip to content

Instantly share code, notes, and snippets.

@woolfg
woolfg / git_migrate.sh
Created April 21, 2020 17:48
Script to migrate / move a git repository (incl. tags and branches) to new remote destination
#!/bin/bash
#
# Script migrates git repos incl. branches and tags
# from an old remote host to a new one
#
# Specify one old and new remote destination per line
# and separate them with a space
repos=(
"git@git.inlupus.at:inlupus_servers/ansible_config.git git@github.com:inlupus/ansible_config.git"
@woolfg
woolfg / list-gcp-container-reg-images.sh
Last active January 15, 2020 16:32
Cleanup GCP container registry and delete all tagged images but the latest one
#!/bin/bash
# this script lists all images and available tags and proposes commands to delete older images
# adapt the registry uri of the gcp container registry
registry=eu.gcr.io/YOUR_PROJECT_ID
NL=$'\n'
echo "fetching repos..."
repos=$(gcloud container images list --repository $registry | tail -n +2)
@woolfg
woolfg / meetingfriends.py
Created October 30, 2018 22:29
Get a ranked list of people that you spend the most time with in outlook meetings
from datetime import timedelta, datetime
from calendar import monthrange
from exchangelib import DELEGATE, Account, Credentials, EWSDateTime, EWSTimeZone, Configuration
import getpass
email = raw_input('Enter your email address: ')
password = getpass.getpass('Enter your password: ')
credentials = Credentials(email, password)
config = Configuration(server='outlook.office365.com', credentials=credentials)
@woolfg
woolfg / index.js
Last active May 31, 2018 13:51
Serverless approach to deliver Emails to Slack using Mailgun & Google Cloud Functions
//Disclaimer: this code is a quick and dirty proof of concept and I am not a JavaScript developer
//see the full story on Medium: https://medium.com/@schafele/serverless-firefighting-deliver-emails-to-slack-using-mailgun-google-cloud-functions-a7e10475d1a2
const channel = "#yourchannel";
const username = "alarm";
const token = "your token";
const { WebClient } = require('@slack/client');
const web = new WebClient(token);
@woolfg
woolfg / gist:4eba01ff6ca3fd6d1fb1
Last active August 29, 2015 14:14
Migrate FusuionInvoice1.3.5 to InvoicePlane 1.2.2
First Step: Migrate Tool
Second Step: Setup of InvoicePlane
Additional SQL Commands:
ALTER TABLE `ip_invoices` ADD `invoice_status_id` TINYINT(2) NOT NULL DEFAULT '1' AFTER `client_id`;
ALTER TABLE `ip_quotes` ADD `quote_status_id` TINYINT(2) NOT NULL DEFAULT '1' AFTER `client_id`;
set all invoices to status "paid" (sent=2):
@woolfg
woolfg / gist:50b1ee17c8e4aa4c8a92
Last active September 25, 2023 12:47
d3.js german locale - create time scale axis with german locale
var germanFormatters = d3.locale({
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["€", ""],
"dateTime": "%a %b %e %X %Y",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],