Skip to content

Instantly share code, notes, and snippets.

Stefan Wienert zealot128

View GitHub Profile
@zealot128
zealot128 / run.sh
Created Dec 20, 2018
pngquant - optimize all png inplace in a folder
View run.sh
find -type f -name '*.png' | xargs -I@ pngquant -f -o '@' '@'
@zealot128
zealot128 / README.md
Last active Oct 17, 2018
ActiveStorage migration guide and caveats from Carrierwave (similar starting point for Paperclip)
View README.md

Migrate Carrierwave to ActiveStorage

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

require 'migrate_attachment'
migrate_attachment!(
  klass: Organisation, 
  attachment_attribute: :logo, 
  carrierwave_uploader: LogoUploader, 
View DirectUpload.vue
<template lang='pug'>
div.drop-zone(:class='{dragging: isDragging }'
@dragover.prevent='dragover'
@dragenter.prevent='dragover'
@drop.prevent.stop='onDrop'
@dragleave.prevent='dragleave')
div(:class='{ hidden: uploadInProgress }' @click='openFileBrowser')
slot
i {{label}}
input(type='file' :multiple='multiple' ref='input' style='display: none')
@zealot128
zealot128 / vornamen.rb
Last active Sep 24, 2018
Vornamen finder - Populaere Vornamen (Berliner OpenData) greppen nach Namensbestandteilen, z.B. `ruby vornamen.rb m scha` alle Namen mit scha im Namen.
View vornamen.rb
require 'csv'
unless ARGV.count == 2
puts "USAGE: #{__FILE__} [GENDER: m|f] SEARCH"
end
gender = ARGV[0]
require 'open-uri'
all = []
[
View ActiveStorageUpload.vue
<template lang='pug'>
div.drop-zone(:class='{dragging: isDragging }'
@dragover.prevent='dragover'
@dragenter.prevent='dragover'
@drop.prevent.stop='onDrop'
@dragleave.prevent='dragleave')
div(:class='{ hidden: uploadInProgress }')
slot(ref='slot')
.list-group
@zealot128
zealot128 / README.md
Last active Jun 21, 2018
Ruby: check for domain name certificate expirations (supports starttls smtp and tls/https)
View README.md

Check

check for domain tls certificate expirations.

Pass any number of domain:port pairs to the program, it will try to fetch all and present a little table with the soonest to expire on top.

On port 25 it will use Starttls for validation, otherwise SNI TLS.

ruby check.rb my.domain.de www.domain.de mail.domain.de:25 pop.domain.de:995
@zealot128
zealot128 / vimrc.vim
Last active Jun 19, 2018
VIM replace ruby 1.9 Hash literals to 2+
View vimrc.vim
command! ReplaceRuby19Hash :%s/:\([a-z_]\+\) *=> */\1: /
@zealot128
zealot128 / rails_5.2-fixes.md
Last active Jun 4, 2018
Rails 5.2. be_success -> be_successful
View rails_5.2-fixes.md

Rails 5.2. be_success -> be_successful

using ag or fgrep

sed -i 's/be_success$/be_successful/g' `ag be_success$ spec -l`

image_tag resolver

@zealot128
zealot128 / README.md
Created Jun 2, 2018
Strava personal heatmap
View README.md
@zealot128
zealot128 / fix.sh
Created Apr 3, 2018
Fix out of space problem after unattended upgrades clogged up boot with linux kernel images
View fix.sh
sudo apt-get autoremove;sudo apt-get autoclean;sudo apt-get clean
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
sudo apt-get update && sudo apt-get upgrade
# source: https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1357093/comments/111
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.