Skip to content

Instantly share code, notes, and snippets.

View novoid's full-sized avatar

Karl Voit novoid

View GitHub Profile
@novoid
novoid / vkrename_according_to_dirname.py
Created July 24, 2022 15:23
This tool renames a file according to its parent directory name
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
PROG_VERSION = "Time-stamp: <2022-03-13 22:56:40 vk>"
# TODO:
# - fix parts marked with «FIXXME»
# ===================================================================== ##
# You might not want to modify anything below this line if you do not ##
@novoid
novoid / vk-cronjob-anyhost-appendorgheading-if-syncconflict.sh
Created December 2, 2020 20:24
Checking for syncthing conflict files and adding them to my Org mode agenda
#!/bin/bash
## This script appends to ORGFILE when syncthing conflict files are located on the host.
## setup:
## 1. pip3 install appendorgheading https://github.com/novoid/appendorgheading
## 2. modify ORFGILE to match an Org mode file which is part of your agenda (in order to get notified).
## 3. create a cronjob entry for this script to run, e.g., daily.
HOSTNAME=$(uname -n)
@novoid
novoid / vkbackup
Created August 29, 2020 10:30
Backup shell script using rsnapshot (rsync)
#!/bin/sh
## My one and only backup script for the future :-)
## Uses rsnapshot.
##
## Please do read this blog article about that script: https://Karl-Voit.at/2020/08/29/vkbackup/
##
## ---------------------------------------------------
##
## Initial setup:
@novoid
novoid / vk-get-crontab-and-misc.sh
Created August 24, 2020 09:44
vk-get-crontab-and-misc.sh
#!/bin/sh
## this script saves crontabs and misc things to a file
readonly SCRIPTNAME=$(basename $0)
readonly HOST=$(hostname)
OUTPUTDIR="${HOME}/archive/backup/"
[ "x$HOST" = "xHOSTX" ] && OUTPUTDIR="${HOME}/hosts/HOSTX/archive"
[ "x$HOST" = "xHOSTBUSINESS" ] && OUTPUTDIR="${HOME}/share/backup"
@novoid
novoid / vkbackup-system-config.sh
Created August 24, 2020 09:41
vkbackup-system-config.sh
#!/bin/sh
VERSION="Time-stamp: <2019-10-10 17:18:58 vk>"
## This script backups several things to a given target directory
## Initial tings to backup are taken from:
## https://www.debian.org/releases/stretch/amd64/release-notes/ch-upgrading.en.html
## -> "4.1.1. Back up any data or configuration information"
## «The main things you'll want to back up are the contents of /etc, /var/lib/dpkg, /var/lib/apt/extended_states and
@novoid
novoid / vkorgheadingstats.sh
Created May 2, 2020 09:08
A shell script that derives basic statistics on one or more Org mode files
#!/bin/sh
FILES="${@}"
USERTAG="@KarlVoit"
no_files_found()
{
echo "No files found. Please do give me some Org-mode files as parameter" >&2
exit 1
}
@novoid
novoid / yankpad.org
Created November 15, 2019 13:31
Emacs yankpad template for adding a new contact

\** `(my-capture-prompt “First name” ‘my-firstname)` `(my-capture-prompt “Last name” ‘my-lastname)` :`(my-capture-insert ‘my-firstname)“(my-capture-insert ‘my-lastname)`:

@novoid
novoid / Org mode test.org
Created May 16, 2019 10:44
Org mode collaborative editing

This is a test file to play around with Org mode syntax based files and collaborative editing of them.

Feel free to modify this file.

This Is A Heading

This Is A Sub-Heading

And A Sub-Sub-Heading

Paragraphs are separated by at least one empty line.

@novoid
novoid / setup.py
Created October 8, 2018 12:42
setup.py for Memacs (brainstorming)
# from distutils.core import setup
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
# workaround from https://github.com/pypa/setuptools/issues/308 to avoid "normalizing" version "2018.01.09" to "2018.1.9":
import pkg_resources
@novoid
novoid / guess-target-folder.sh
Last active March 4, 2024 13:11
Moving files to pre-defined standard directories according to their file name or file content
#!/bin/sh
FILENAME=$(basename $0)
DEBUG="true" ## if true, verbose debug output is activated
DEBUG="false"
ERRORFOLDER="unknown_destinations" ## if found as a sub-directory, all non-matching files are moved there
SIMULATE="true" ## if true, no files are moved
SIMULATE="false"
warn_and_exit()
{