Skip to content

Instantly share code, notes, and snippets.

View glaszig's full-sized avatar

glaszig

  • available for hire. contact me.
  • remote
View GitHub Profile
@glaszig
glaszig / fswatch-scp.sh
Last active August 17, 2023 11:13
use fswatch to scp changed files to remote host
#!/usr/bin/env sh
# Copyright 2020 glaszig
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@glaszig
glaszig / plugin.js
Last active August 11, 2023 19:07
tom-select flexbox options plugin
/**
* tom-select plugin that wraps each select option in a flexbox to improve layout.
* made explicitly to use in combination with checkbox_options plugin.
*
* required css:
*
* .ts-option-wrapper {
* display: flex;
* align-items: center;
* }
@glaszig
glaszig / curl_action_mailbox.md
Last active June 27, 2023 08:53
rails' action mailbox without installing rails on your mail server

forward email to action mailbox without installing rails

rails provides [rake tasks][rake] to forward mails to [action mailbox][actionmailbox]'s [relay ingress][postfix]. that's fine unless you have your mail server(s) on another system and don't want to install rails (and all dependencies, i.e. the ruby runtime).
since the rake tasks basically just [upload stdin to your rails app via http][relayer] you can do everything with curl.

action-mailbox-relayer.sh

#!/usr/bin/env sh
curl -sS -u "actionmailbox:$INGRESS_PASSWORD" \
@glaszig
glaszig / fingerprint.sh
Created September 4, 2015 20:40
show ssl fingerprints for remote hosts
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: `basename $0` hostname [hostname]..."
exit $E_NOARGS
fi
until [ -z "$1" ]; do
host=$1
@glaszig
glaszig / passlib_plugin.py
Created August 12, 2015 22:52
ansible passlib filter plugin
# this ansible/jinja2 filter plugin allows you to use passlib's *_crypt functions
# until ansible 2.0 comes out - see https://github.com/ansible/ansible/issues/11244.
#
# this filter depends on passlib being installed:
# $ pip install passlib
#
# put this into your playbook's `filter_plugins` folder.
#
# usage example:
# - name: create user
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "activerecord", "6.1.0"
@glaszig
glaszig / mkm3u.sh
Created June 29, 2022 04:47
generate m3u from directory
#!/usr/bin/env sh
# generates extended m3u for all media files in a directory.
#
# requirements: ffprobe (ffmpeg)
# usage: $0 path/to/media/files [playlist.m3u]
# author: mail@glasz.org
# license: wtfpl - http://www.wtfpl.net/txt/copying/
set -e
@glaszig
glaszig / mkp2pblocklist
Last active January 30, 2022 00:30
creates a blocklist for your p2p endeavors
#!/usr/bin/env sh
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2020 glaszig <glaszig@gmail.com>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
@glaszig
glaszig / application.rb
Created March 10, 2016 11:57
Grouped table index for ActiveAdmin
# config/application.rb
module MyApp
class Application < Rails::Application
config.autoload_paths << config.root.join('lib')
end
end
@glaszig
glaszig / gitea-backup-s3.sh
Last active January 24, 2020 15:23
FreeBSD Gitea backup to AWS S3
#!/usr/bin/env sh
#
# requires openssl >= 1.1.1 due to usage of -pbkdf2 option
#
# to decrypt the encrypted backup:
# openssl aes-256-cbc -d -a -salt -pbkdf2 -in gitea-dump.zip.enc -out gitea-dump.zip -pass pass:your-password
#
# conifgure with a dotfile `.backuprc` in your $HOME:
# BUCKET="foobar"
# GITEA_CUSTOM=/usr/local/etc/gitea