Skip to content

Instantly share code, notes, and snippets.

@zmousm
zmousm / phabricator.sieve
Created April 25, 2019 07:44
phabricator mail address header normalization: To: -> differential reviewers or maniphest task owner, Cc: subscribers (up to 3)
require [ "regex", "editheader", "relational", "variables" ];
if header :is "X-Phabricator-Sent-This-Message" "Yes" {
# assumption: common mail domain
set "msfx" "@example.com";
# match up to 3 subscribers
if header :regex "X-Phabricator-Stamps" "subscriber\\([@#]([^\\)]+)\\)(.+subscriber\\([@#]([^\\)]+)\\))?(.+subscriber\\([@#]([^\\)]+)\\))?" {
set "psub" "${1}${msfx}";
if string :count "ne" "${3}" ["0"] {
set "psub" "${psub}, ${3}${msfx}";
@zmousm
zmousm / git_stale_branches.sh
Last active May 11, 2018 09:45
Notify committers about stale branches in a repository. This is mostly useful in environments where collaborators push to a shared repository.
#!/bin/bash
usage () {
cat >&2 <<EOF
Usage: $0 (-r /path/to/git/repo | -u scheme:///git/repo/to/clone) [OPTIONS]
Detect potentially stale branches in a git repository and notify committers
or a designated party.
Mandatory arguments to long options are mandatory for short options too.
#!/usr/bin/env python
# -*- coding: utf-8; -*-
import sys
import csv
import urllib
import subprocess
import os
import re
from datetime import datetime
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns grnet = "urn:mace:grnet.gr:slax";
import "../import/junos.xsl";
function grnet:snmp_set($val) {
@zmousm
zmousm / limesurvey_2.52_question_types.php
Created September 20, 2017 16:01
LimeSurvey 2.52 question types
<?php
$questionTypes = array(
"1" => array(
'description' => gT("Array dual scale"),
'group' => gT('Arrays')),
"5" => array(
'description' => gT("5 Point Choice"),
'group' => gT("Single choice questions")),
"A" => array(
'description' => gT("Array (5 Point Choice)"),
<?xml version="1.0" encoding="utf-8"?>
<EAPIdentityProviderList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="eap-metadata.xsd">
<EAPIdentityProvider ID="hospital-agrinio.gr" namespace="urn:RFC4282:realm" lang="el" version="1">
<AuthenticationMethods>
<AuthenticationMethod>
<EAPMethod>
<Type>21</Type>
</EAPMethod>
<ServerSideCredential>
<CA format="X.509" encoding="base64">MIIE+TCCA+GgAwIBAgIJAKFnOJwzoM0BMA0GCSqGSIb3DQEBBQUAMIGSMQswCQYDVQQGEwJHUjE9MDsGA1UEChM0R0VORVJBTCBIT1NQSVRBTCBPRiBBSVQvTklBUyBOVVJTSU5HIFVOSVQgT0YgQUdSSU5JTzFEMEIGA1UEAxM7R0VORVJBTCBIT1NQSVRBTCBPRiBBSVQvTklBUyBOVVJTSU5HIFVOSVQgT0YgQUdSSU5JTyBFQVAgQ0EwHhcNMTYwODMwMTU1MDM3WhcNMjYwODI4MTU1MDM3WjCBkjELMAkGA1UEBhMCR1IxPTA7BgNVBAoTNEdFTkVSQUwgSE9TUElUQUwgT0YgQUlUL05JQVMgTlVSU0lORyBVTklUIE9GIEFHUklOSU8xRDBCBgNVBAMTO0dFTkVSQUwgSE9TUElUQUwgT0YgQUlUL05JQVMgTlVSU0lORyBVTklUIE9GIEFHUklOSU8gRUFQIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsbWwuD4f3iAeT/mEM
--------- beginning of crash
E/AndroidRuntime( 3138): FATAL EXCEPTION: main
E/AndroidRuntime( 3138): Process: uk.ac.swansea.eduroamcat, PID: 3138
E/AndroidRuntime( 3138): java.lang.RuntimeException: Unable to start activity ComponentInfo{uk.ac.swansea.eduroamcat/uk.ac.swansea.eduroamcat.EAPMetadata}: java.lang.NumberFormatException: Invalid double: "38,6321"
E/AndroidRuntime( 3138): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
E/AndroidRuntime( 3138): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
E/AndroidRuntime( 3138): at android.app.ActivityThread.access$800(ActivityThread.java:151)
E/AndroidRuntime( 3138): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
E/AndroidRuntime( 3138): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3138): at android.os.Looper.loop(Looper.java:135)
@zmousm
zmousm / validate-multi-xsd.py
Created October 25, 2015 11:38 — forked from tomkralidis/validate-multi-xsd
using Python lxml to do XML Schema validation on a document, against multiple XML Schema (courtesy @rouault)
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Portions coming from EOxServer
# ( https://github.com/EOxServer/eoxserver/blob/master/eoxserver/services/testbase.py )
# Copyright (C) 2011 EOX IT Services GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

git push/fetch over stdio

Git uses send-pack and fetch-pack for transferring data over the smart protocol,. These plumbing commands are a bit too smart for their own good, in the sense that they always try to run their peer commands (receive-pack and upload-pack respectively), either on the local host or over ssh to the remote host (for file:// and

@zmousm
zmousm / jira.sieve
Last active December 29, 2015 10:39
jira mail address header sanitization
require [ "regex", "editheader", "relational", "variables" ];
if header :regex "X-JIRA-FingerPrint" "^(jira-server1-fingerprint|server2-fingerprint)$" {
# assumption: common mail domain
set "msfx" "@example.com";
# match up to 3 g.assignees
if header :regex "X-JIRA-GroupAssignee" "^(([^ ]+) ?)(([^ ]+) ?)?(([^ ]+) ?)?$" {
set "gass" "${2}${msfx}";
if string :count "ne" "${4}" ["0"] {
set "gass" "${gass}, ${4}${msfx}";