Skip to content

Instantly share code, notes, and snippets.

View ucyo's full-sized avatar
🎯
Focusing

Cayoglu ucyo

🎯
Focusing
View GitHub Profile
@ucyo
ucyo / journal.py
Created January 28, 2024 09:39
Journal
"""Journaling application for daily notes, tasks and information blocks from meetings, calls and self-study.
There are 5 categories: Context, Information, Decision, Todo/Action for others, Todo/Action for me.
The categories are represented by the first letter of the category name with A for Actions for others and T for my Todos.
All notes are stored in a single file with the name Journal-<YEAR>.md. The file is created if it does not exist.
The file is stored in the same directory as the script.
The file contains a YAML metadata block with the title, description and usage information.
"""
import os
import datetime
@ucyo
ucyo / Makefile
Created August 29, 2022 08:46
Sane Makefile options
-include .env # optional environment file `.env` (mandatory file w/o the `-`)
MODE ?= development # Dynamic environment variable defaulting to `development` and can be set via `make up MODE=production`
export
build:
@echo "===================================================================="
@echo "Building services"
@echo "===================================================================="
@docker compose build
up:
@ucyo
ucyo / check_mounts.sh
Last active January 20, 2022 15:26
Check a list of mount points and send an email if the mount is not active
#!/usr/bin/env bash
set -Ee # fail script, if single command fails
set -u # unset variables are treated as errors
set -f # no filename extension
set -o pipefail # if a subcommand from a pipe fails, the whole pipe fails
trap cleanup SIGINT SIGTERM ERR EXIT # execute cleanup function at following signals
SOURCE_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) # location of script
@ucyo
ucyo / script.sh
Last active August 2, 2022 15:50
Sane bash script template
#!/usr/bin/env bash
set -Ee # fail script, if single command fails
set -u # unset variables are treated as errors
set -f # no filename extension
# set -x # verbose mode
set -o pipefail # if a subcommand from a pipe fails, the whole pipe fails
trap cleanup SIGINT SIGTERM ERR EXIT # execute cleanup function at following signals
SOURCE_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) # location of script
@ucyo
ucyo / app.py
Created April 23, 2021 20:33 — forked from thomasdarimont/app.py
Simple python example using flask, flask_oidc and keycloak, needs a small patch of flask_oidc: https://github.com/puiterwijk/flask-oidc/issues/35
import json
import logging
from flask import Flask, g
from flask_oidc import OpenIDConnect
import requests
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@ucyo
ucyo / README.md
Last active December 31, 2020 14:28
Recovery of old macintosh drive using disk to disk (dd) 👀

Create backup of old data

Be aware that the target device must be of a least the same size as the source device

Let /dev/sda be the target device and /dev/sdb be the source device.

  1. Check end sector (ES) and block size (BS) of source device
> sudo fdisk -l /dev/sdb
Disk /dev/sdb: 113 GiB, 121332826112 bytes, 236978176 sectors
#!/usr/bin/env python
# coding: utf-8
"""Application for distribution of topics to authors based on preference"""
import random
import math
from collections import Counter
MINIMUM = 0
MAXIMUM = 100
@ucyo
ucyo / earthjsonfromwrf.py
Created May 26, 2020 09:02 — forked from barronh/earthjsonfromwrf.py
Creates a json in the format required by earth[1] from Weather Research and Forecasting (WRF) outputs.
from __future__ import print_function, unicode_literals
import os
import json
import numpy as np
from netCDF4 import Dataset
import argparse
from argparse import RawDescriptionHelpFormatter
@ucyo
ucyo / singles.sh
Created August 22, 2019 14:55
Singles
# Find all files ending with *.ipynb excluding checkpoint files and sort by last modified
find -type f -name "*.ipynb" -not -name "*checkpoint*" -printf "%T@ %Tc %p\n" | sort -n
@ucyo
ucyo / latex.json
Last active August 15, 2019 10:10
snippets
{
// Place your snippets for latex here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",