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 /
Last active Oct 1, 2019
Gitlab migrate omnibus installation to new server
# the old host, must have direct ssh access
# generate ssh-keygen on new host and copy over into authorized_keys
# Stopping everything on remote system
echo "$gitlab - Gitlab Stop"
ssh $gitlab "gitlab-ctl stop nginx"
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
# - 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 / 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'
BOX = ''
gemfile do
source ''
gem 'http'
gem 'tty-prompt', require: 'tty/prompt'

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 /
Last active May 1, 2019
Bootstrap 3 -> 4 simplistic migration script (Rails based paths and file types)
  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 /
Last active Jul 28, 2019
Gitlab Autoscaling Infrastructure on Hcloud with internal caching

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

See my blog for more information.

  • Adjust settings in
  • Run with terraform init && terraform apply


zealot128 /
Last active Aug 15, 2019
Gitlab runner with docker by cloud init on Hetzner Cloud

Quick Terraform script to deploy Gitlab runner with docker onto Hetzner Cloud (Hcloud)

  1. Create other terraform stuff
  • tf-backend,
  • with hcloud_token
  • ssh key: mkdir keys; ssh-keygen -f id_rsa
  1. modify cloudinit.yml:
  • change gitlab url
  • ADD_YOUR_REGISTRY_TOKEN -> Set to the Gitlab Runner Registration Token
  • Add more allowed images/services, if using gitlab registry, like that:*, change base image etc.
zealot128 /
Created Dec 20, 2018
pngquant - optimize all png inplace in a folder
find -type f -name '*.png' | xargs -I@ pngquant -f -o '@' '@'
zealot128 /
Last active Oct 17, 2018
ActiveStorage migration guide and caveats from Carrierwave (similar starting point for Paperclip)

Migrate Carrierwave to ActiveStorage

Migrate, e.g. organisation.logo (Carrierwave "LogoUploader") to organisation.logo2 (ActiveStorage)

require 'migrate_attachment'
  klass: Organisation, 
  attachment_attribute: :logo, 
  carrierwave_uploader: LogoUploader, 
View DirectUpload.vue
<template lang='pug'>
div.drop-zone(:class='{dragging: isDragging }'
div(:class='{ hidden: uploadInProgress }' @click='openFileBrowser')
i {{label}}
input(type='file' :multiple='multiple' ref='input' style='display: none')
You can’t perform that action at this time.