Skip to content

Instantly share code, notes, and snippets.

View pifabs's full-sized avatar

pifabs

View GitHub Profile
@pifabs
pifabs / example.py
Created April 26, 2021 14:50
JSON Schema validator
# example.py
from jsonschema import FormatChecker
from .jsonschema_validator import get_validator
USER_SCHEMA = {
"$schema":"http://json-schema.org/draft-07/schema#",
"title":"User",
"type" : "object",
"properties" : {
@pifabs
pifabs / util.py
Created June 15, 2021 13:08
Remove duplicate dicts in list having the same values for a given set of keys
def remove_duplicates_by_keys(arr, keys):
template = ":".join(["{{{}}}".format(key) for key in keys])
return list({template.format(**el): el for el in arr}.values())
data = [
{
"key1": "A",
"key2": "B"
},

Git Merge To FF Or Not To FF

Created May 13, 2020

Intro

In git merge there are several ways to merge branches however, the most commonly used options are --ff-only and --no-ff. The --ff-only option will resolve the merge as a fast-forward when possible. When not possible, it refuses to merge and will exit with a non-zero status. Best examples used by this options are branches from features and hotfixes.

Merge develop to master

@pifabs
pifabs / SaveAsFleetingNote.sh
Created January 8, 2023 07:33
A gedit Exernal Tool that saves a note as an .md file to your obsidian vault
#!/usr/bin/env python3
import shutil
import os
# Get the current file's path and name
current_file_path = os.getenv('GEDIT_CURRENT_DOCUMENT_PATH')
current_file_name = os.path.basename(current_file_path)
# Set the destination directory and file extension