Skip to content

Instantly share code, notes, and snippets.

@tho
tho / .golangci.yml
Last active August 15, 2024 12:56
golangci-lint configuration
# For details see:
# - https://golangci-lint.run/usage/configuration/
# - https://golangci-lint.run/usage/linters/
run:
issues-exit-code: 2
modules-download-mode: readonly
output:
sort-results: true
@tho
tho / 01 - miniflux-flyio.md
Last active April 13, 2024 20:01
Deploy Miniflux on Fly.io

Deploy Miniflux on Fly.io

Miniflux is a minimalist and opinionated feed reader.

Prerequisites

@tho
tho / miniflux-heroku.md
Last active April 24, 2022 14:35
Deploy Miniflux on Heroku
@tho
tho / README.md
Created January 9, 2018 02:33
Simple Ansible test setup

Simple Ansible test setup

Execute on localhost

If the tasks are simple enough and/or non-invasive.

$ ansible -c local -i localhost, -m ping all
localhost | SUCCESS => {

"changed": false,

@tho
tho / ansible-reboot-host.md
Last active January 9, 2018 02:40
Reboot host with Ansible

Reboot host with Ansible

- name: Reboot host
  shell: sleep 2 && shutdown -r now "Reboot initiated by Ansible"
  async: 1
  poll: 0
  become: True
  listen: reboot_host
@tho
tho / python-virtual-environments.md
Created August 12, 2017 16:42
Python Virtual Environments

Python 2

  • Installing and setting up packages

      pip2 install virtualenv virtualenvwrapper
    
      # ~/.profile
      if command -v virtualenvwrapper.sh >/dev/null; then
          export WORKON_HOME=$HOME/.virtualenvs
    

export PROJECT_HOME=$HOME/src

@tho
tho / verify-digest
Last active January 9, 2018 02:43
Verify digests/SHASUMS of files and optionally validate digests' PGP signature if specified
#!/usr/bin/env bash
set -euf -o pipefail
if (($# < 2 || $# > 4)); then
echo "usage: ${0##*/} file digest [signature [PGP key|key ID]]"
exit 1
fi
file=$1
@tho
tho / is_format_string.py
Created August 7, 2016 01:26
Python is_format_string() predicate
def is_format_string(s):
"""Test if the given string is a format string.
Args:
s (str): String to test.
Returns:
bool: True if `s` is a format string, False otherwise.
Bugs:
@tho
tho / osx-irssi-sasl
Created July 13, 2014 03:45
OS X, irssi, sasl
$ brew install irssi gmp
$ cpan install Crypt::OpenSSL::Bignum Crypt::Blowfish Crypt::DH::GMP
$ echo '[[ $SHLVL -eq 1 ]] && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bashrc
$ mkdir -p ~/.irssi/scripts/autorun
$ (cd ~/.irssi/scripts/; wget https://freenode.net/sasl/cap_sasl.pl; ln -s ../cap_sasl.pl autorun/)
$ irssi
/sasl set <network> <nick> <password> DH-BLOWFISH
/sasl save