Skip to content

Instantly share code, notes, and snippets.

Stefan Wienert zealot128

Block or report user

Report or block zealot128

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zealot128
zealot128 / README.md
Last active Apr 21, 2020
Papercut simple replacement = IMAP to print
View README.md

Papercut replacement

  • imap to print
  • use case: on a Raspi oder Office server that hangs in the same LAN like the printer and can print via cups/system using "lp"
  • just uses lp under the hood
  • uses the awesome mail_room Gem under the hood to handle imap connection, which does most of the lifting

Send Mail as a authorized return-path (via regex matching) to your mailbox, it will print all pdf Attachments.

USAGE

@zealot128
zealot128 / elasticsearch_move_all_shards.sh
Last active Mar 30, 2020
Elasticsearch: migrate ALL shards from a master node to other nodes (e.g. mark all shards to move to other node before shutting down)
View elasticsearch_move_all_shards.sh
#!/bin/bash
# cluster
server="10.10.10.153:9200"
# new master node name
target="node123"
# fetch all index names
indices=`curl $server/_cat/indices?h=index`
@zealot128
zealot128 / Rails-application-generator-template.md
Last active Jan 17, 2020
Rails application template that I use - based on rails_composer
View Rails-application-generator-template.md
rails new -m https://gist.github.com/zealot128/b70b95c0d665e95647c210808b614a51/raw/ad5aba858c5a9da559b5717015e59392856614b2/composer.rb new_app_name
  • Less interaction than original composer script (no example templates)

Default choices that I use:

 prefs[:dev_webserver] = 'puma'
@zealot128
zealot128 / gist:736de424147789330575509354a53e97
Created Dec 2, 2019
Ubuntu 18.04 ttf-mscorefonts-installer fails with redirection forbidden
View gist:736de424147789330575509354a53e97
wget http://ftp.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.7_all.deb
dpkg -i ttf-mscorefonts-installer_3.7_all.deb
@zealot128
zealot128 / gitlab_migrate.sh
Last active Oct 1, 2019
Gitlab migrate omnibus installation to new server
View gitlab_migrate.sh
#!/bin/bash
# ATTENTION: COPY&PASTE RUN EVERY LINE BY HAND AND VERIFY THE OUTPUT
# the old host, must have direct ssh access
# generate ssh-keygen on new host and copy over into authorized_keys
gitlab='root@1.2.3.4'
# Stopping everything on remote system
echo "$gitlab - Gitlab Stop"
ssh $gitlab "gitlab-ctl stop nginx"
@zealot128
zealot128 / vue_i18n_scanner.rb
Created Sep 24, 2019
Vue-i18n + ruby i18n-tasks unused scanner
View vue_i18n_scanner.rb
require 'i18n/tasks/scanners/file_scanner'
# finds v-t="" and $t/$tc usages and prefixed that usages with the given prefix, e.g.
# so i18n-tasks unused / i18n-tasks missing will work and scan vue files correctly
# LIMITATIONS:
# - no advanced v-t="{ ... }" syntax supported
# - of course, no dynamic loading of $t(some_data_property) does not work
class VueI18nScanner < I18n::Tasks::Scanners::FileScanner
include I18n::Tasks::Scanners::OccurrenceFromPosition
@zealot128
zealot128 / download_zonefile.rb
Last active Aug 24, 2019
Mailinabox Ruby API - Zonefile Generation. Downloads all DNS record from your MAIB instance and write valid zonefiles for easy C&P and Version controlling
View download_zonefile.rb
require 'bundler/inline'
IGNORE_RECORD_TYPES = ['SSHFP', 'TLSA']
BOX = 'box.yourserver.com'
ADMIN_EMAIL = 'admin@yourserver.com'
gemfile do
source 'https://rubygems.org'
gem 'http'
gem 'tty-prompt', require: 'tty/prompt'
@zealot128
zealot128 / ActiveStorageDocxPreviewer.md
Last active Mar 30, 2020
Activestorage Docx Previewer
View ActiveStorageDocxPreviewer.md

Docx (and other Office doc) previewer support for ActiveStorage

Converts all document formats using LibreOffice first to PDF and then to an image, using build-in pdf previwer of ActiveStorage

  • needs: unoconv, a command line tool which uses libreoffice, e.g. apt install unoconv
  • needs a PDF converter, because libreoffice will make a pdf from the office document, Mupdf oder Poppler are already integrated into ActiveStorage, and poppler is free to use, e.g. apt install poppler-utils
@zealot128
zealot128 / Bootstrap4migration.md
Last active May 1, 2019
Bootstrap 3 -> 4 simplistic migration script (Rails based paths and file types)
View Bootstrap4migration.md
  1. Run against code base to make the most labor intensive work
  2. Totally redo navigation from scratch
  3. maybe add -xs stuff, like col-xs- or btn-xs, thats missing from BS4
@zealot128
zealot128 / README.md
Last active Mar 27, 2020
Gitlab Autoscaling Infrastructure on Hcloud with internal caching
View README.md

Order and provision a Hetzner Cloud based Gitlab-Runner Docker-machine autoscaling infrastructure

See my blog for more information.

  • Adjust settings in vars.auto.tfvars.
  • Run with terraform init && terraform apply

Content:

You can’t perform that action at this time.