Skip to content

Instantly share code, notes, and snippets.

View Mazyod's full-sized avatar

Maz Mazyod

View GitHub Profile
Mazyod /
Last active September 16, 2023 21:34
Bash script that loops over Docker images, and keeps only the latest tag for each image name (Repository).
set -e
echo "Script for cleaning up Docker images"
# First, we grab a list of all images
docker_images=$(docker images --format "{{.ID}}|{{.Repository}}|{{.Tag}}")
# prepare a image name lookup
Mazyod / XcodeBuildScript.cs
Last active June 19, 2022 14:55
Unity script to run a post-build process that adds some keys to Info.plist and some capabilities to the entitlements file.
using System;
using System.IO;
using JetBrains.Annotations;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEngine;
/** See Also:
Mazyod / flask-to-bottle.diff
Created April 3, 2018 15:30
Migrating from Flask to Bottle
-import flask
-from werkzeug.http import Headers
+import bottle
[ ... ]
+# Remove "hop-by-hop" headers (as defined by RFC2613, Section 13)
+# since they are not allowed by the WSGI standard.
+ 'Connection',
Mazyod /
Created January 14, 2020 09:33
Rasa NLU training data migrator from JSON format to Markdown
import json
from pprint import pprint
from collections import defaultdict
from pathlib import Path
def main():
path = Path("./data.json").resolve()
Mazyod /
Created July 31, 2019 17:02
Progress Counter in Python - wrote it before discovering tqdm
from typing import List
from datetime import datetime, timedelta
class PercentageCounter:
"""Counter for stepping percentages over an arbitrary number
e.g. total = 10, step = 0.15 (15%) # progress is 10%, returns nothing # progress is 20%, returns 15 # progress is 30%, returns nothing (has to exceed step)
Mazyod /
Last active April 13, 2019 15:26
Directory/files watchdog in Python
import os
import logging
from queue import Queue, Empty as EmptyQueue
from time import sleep
from threading import Thread
from typing import List
logger = logging.getLogger("watchdog")
Mazyod /
Last active October 10, 2018 11:15
Build a universal iOS framework/library
set -e
# required arguments:
# WORKSPACE_DIR=Networking.xcworkspace
# SCHEME_NAME=Networking
# PRODUCT_NAME=Networking
// UIViewController+DismissOnTapOutside.h
// Telly
// Created by Mazyad Alabduljaleel on 5/8/14.
// Copyright (c) 2014 Telly, Inc. All rights reserved.
#import <UIKit/UIKit.h>
Mazyod / safeAreaTopAnchor.swift
Last active December 9, 2017 18:49
SafeArea Top Constraint Setup, with Backwards Compatability
/** Safe area for status bar dodging only. If you use NavigationBars, this won't help.
let topConstraint: NSLayoutConstraint
if #available(iOS 11.0, *) {
topConstraint = headerContainerView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor)
} else {
let statusBarHeight = UIApplication.shared.statusBarFrame.height
topConstraint = headerContainerView.topAnchor.constraint(equalTo: topAnchor, constant: statusBarHeight)
set -e
CERT_NAME='3rd Party Mac Developer Application: [YOUR NAME]'
# remove existing meta files
find ${APP_NAME} -type f -regex '.*meta' -delete