Skip to content

Instantly share code, notes, and snippets.

View Phlow's full-sized avatar
🐙
🎛️ 🔊

Moritz »mo.« Sauer Phlow

🐙
🎛️ 🔊
View GitHub Profile
@Phlow
Phlow / posting.sh
Last active January 23, 2018 12:17
Ask for a title and create a post for Jekyll in _posts and open in in your favorite editor
#!/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 December 6, 2017 16:02
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.
#!/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 December 23, 2023 20:18
Favicon Generator: Generate favicons on Mac OSX via bash/shell with the help of sips command. Than optimize the images with ImageOptim (App)
#!/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 January 12, 2017 16:21
Bash Script um Dateien mit eigenem Entstehungsdatum und einer gewünschten Zeichenfolge umzubenennen.
#!/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 January 11, 2017 14:17
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`.
#
# 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 January 6, 2017 20:08
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.
{% 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 October 13, 2023 03:10
If you need pagination for a collection in a Jekyll theme, you can use the following Liquid logic which works also on Github pages
{% 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 August 17, 2022 05:14
Harden your WordPress and hide wp-config.php and .htaccess for attackers.
# 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 November 24, 2021 16:00
enable gzip compression via .htaccess – Useful for WordPress and other sites
<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 August 8, 2022 14:32
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
<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>