Skip to content

Instantly share code, notes, and snippets.

View tachylatus's full-sized avatar

Helge Willum Thingvad tachylatus

  • Aalborg, Denmark
View GitHub Profile
@daladim
daladim / run-as-cron.sh
Last active January 10, 2025 16:02
Run a command or a script as cron would
#!/bin/bash
# Run as if it was called from cron, that is to say:
# * with a modified environment
# * with a specific shell, which may or may not be bash
# * without an attached input terminal
# * in a non-interactive shell
# This scripts supports cron jobs run by any user, just run it as the target user (e.g. using sudo -u <username>)
# An up-to-date version of this script may be available at https://github.com/daladim/run-as-cron
@fnky
fnky / ANSI.md
Last active July 1, 2025 17:18
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@echo off
::
:: logrotate.bat - Log rotation for windows
::
:: Usage: logrotate.bat filename maxfilecount [maxfilesize]
::
:: filename : The file name to rotate.
:: maxfilecount: Number of backup files.
:: maxfilesize : Rotated if the size of file exceeds specified size.
:: (Default is 0. Unit notation is available (K, M and G))