Skip to content

Instantly share code, notes, and snippets.

Avatar
🐙
🎛️ 🔊

Moritz »mo.« Sauer Phlow

🐙
🎛️ 🔊
View GitHub Profile
@Phlow
Phlow / posting.sh
Last active Jan 23, 2018
Ask for a title and create a post for Jekyll in _posts and open in in your favorite editor
View posting.sh
#!/bin/bash
#
# Create a post for Jekyll
# Configuration
EDITOR='Atom'
DATE=`date +%Y-%m-%d`
DOCFORMAT='md' # Without Point (!)
DIRECTORY='./_posts/'
@Phlow
Phlow / resize-rename-sips-information.sh
Last active Dec 6, 2017
This script makes a copy of images, resizes the copied images and renames the copied images with the correct width and height. The information gets the script from sips.
View resize-rename-sips-information.sh
#!/bin/bash
#
# 1. This script copies all *.jpg-files to a new folder
# 2. Jumps into folder and resizes all files with sips
# 3. Renames all files and uses information from sips
#
folder="processed"
height="320"
width="160" # not used
@Phlow
Phlow / favicon.sh
Last active Sep 11, 2019
Favicon Generator: Generate favicons on Mac OSX via bash/shell with the help of sips command. Than optimize the images with ImageOptim (App)
View favicon.sh
#!/bin/sh
#
# Dieses Script fragt nach einer Bildatei, die dann in die
# verschiedenen Favicon-Größen mittels sips-Kommandos
# umgewandelt werden. Ist auf dem Rechner das Programm
# ImageOptim installiert, dann werden die Bilddateien
# anschließend verlustlos optimiert.
# Farben in Variablen schreiben (schönerer Output)
reset='\x1B[0m'
@Phlow
Phlow / renamedate.sh
Last active Jan 12, 2017
Bash Script um Dateien mit eigenem Entstehungsdatum und einer gewünschten Zeichenfolge umzubenennen.
View renamedate.sh
#!/bin/bash
# Rename Files with Date from File plus Extra Characters
clear;
# Farben zurücksetzen
printf '\e[0m'
echo " ____ ____ ____ ____ ____ ____ ____ "
echo " ||R |||e |||n |||a |||m |||e |||r ||"
echo " ||__|||__|||__|||__|||__|||__|||__||"
echo " |/__\|/__\|/__\|/__\|/__\|/__\|/__\|"
echo
@Phlow
Phlow / rename_file_with_file_date.sh
Created Jan 11, 2017
When renaming files in terminal, you can use their time stamp. This bash/shell script helps you. It uses `stat` to get the information, formats the time stamp with `date` and renames each file with `mv`.
View rename_file_with_file_date.sh
#
# When renaming files in terminal, you can use their time stamp. This bash/shell script helps you.
#
# One liner: for f in *.jpg; do D=$(date -r $(stat -f %B $f) +%Y-%m-%d-%H-%M-%S); mv -vi "$f" "$D-$f"; done
for datei in *.jpg
do VARIABLE_WITH_FORMATTED_DATE=$(date -r $(stat -f %B $datei) +%Y-%m-%d-%H-%M-%S)
mv -vi "$datei" "$VARIABLE_WITH_FORMATTED_DATE-$file"
done
@Phlow
Phlow / nested-for-loop.liquid
Created Jan 6, 2017
This is a nested liquid loop for Jekyll to iterate through YAML data with a depth of three levels. The example loops through a potential table of contents of a book.
View nested-for-loop.liquid
{% comment %}
#
# This is a nested liquid loop for Jekyll to iterate through YAML data with
# a depth of three levels. The example loops through a potential table of
# contents of a book.
#
# This is the example YAML content'
- chapters: 'Einführung'
sub_chapters:
@Phlow
Phlow / pagination-collection.liquid
Last active Mar 16, 2022
If you need pagination for a collection in a Jekyll theme, you can use the following Liquid logic which works also on Github pages
View pagination-collection.liquid
{% comment %}
#
# I modified the original code from http://anjesh.github.io/2015/01/25/collection-pagination-working-github-pages/
#
# Make a collection in _config.yml and create the folder _your_collection in your root.
#
# collections:
# your_collection:
# output: true
# permalink: /:collection/:title/
@Phlow
Phlow / Hide wp-config.php and .htaccess
Last active Aug 17, 2022
Harden your WordPress and hide wp-config.php and .htaccess for attackers.
View Hide wp-config.php and .htaccess
# Prevent wp-config.php and .htaccess
# from being accessed use this code
<Files wp-config.php>
order allow,deny
deny from all
</Files>
<Files .htaccess>
order allow,deny
@Phlow
Phlow / gzip-htaccess
Last active Nov 24, 2021
enable gzip compression via .htaccess – Useful for WordPress and other sites
View gzip-htaccess
<IfModule mod_deflate.c>
# Komprimiere HTML, CSS, JavaScript, Text, XML und fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
@Phlow
Phlow / vorlage-readibility-artikel.html
Last active Aug 8, 2022
Diese Vorlage basiert auf der Vorgabe des Microformats von Readability. Mehr zu diesen »Article Publishing Guidelines« liest man auf der Website › https://www.readability.com/developers/guidelines #HTML
View vorlage-readibility-artikel.html
<article class="hentry">
<header>
<h1 class="entry-title"></h1>
<h2 class="entry-summary"></h2>
<time class="published" datetime="2012-01-07 11:11:03-0400">
01-07-2012
</time>
<p class="byline author vcard">
Von <span class="fn"></span>
</p>