Skip to content

Instantly share code, notes, and snippets.

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

Moritz »mo.« Sauer Phlow

🐙
🎛️ 🔊
View GitHub Profile
@Phlow
Phlow / rename-files-and-add-suffix.sh
Created September 23, 2015 19:31
Rename files and add a suffix
for file in *; do mv $file `basename $file `.md; done
@Phlow
Phlow / screenshot-optimizer.sh
Last active October 11, 2015 18:06
Shell-Script renaming screenshots, making thumbnails and optimizing images with ImageOptim
#
# Rename Screenshots, Make Thumbnails, Optimize Images with Imageoptim
#
clear;
echo -e '\n- - - - - - - - - - - - - - - - -';
echo -e '\n Screenshotter V.1.0 ';
echo -e '\n- - - - - - - - - - - - - - - - -';
# Wenn Variablen gesetzt sind, dann bitte los...
@Phlow
Phlow / rename-files-with-date.sh
Created October 11, 2015 10:20
Rename files and use their date
#!/bin/bash
# Copy MP3 files in a directory to a new name based solely on creation date
# FROM: foo.mp3 Created on: 2012-04-18 18:51:44
# TO: 20120418_185144.mp3
for i in *.mp3
do
# mod_date=$(stat -c "%y" "$i"|sed 's/\..*$//')
# mod_date=$(stat -c "%y" "$i"|awk '{print $1"_"$2}'|sed 's/\..*$//')
mod_date=$(stat --format %y "$i"|awk '{print $1"_"$2}'|cut -f1 -d'.'|sed 's/[: -]//g')
cp "$i" "$mod_date".mp3
@Phlow
Phlow / .bash_profile
Created October 23, 2015 10:39 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@Phlow
Phlow / list-categories-count.liquid
Last active June 4, 2021 18:33
Jekyll: List all categories with according post count and show and link all post items listed in the according category
<h2>Categories</h2>
<ul>
{% assign categories_list = site.categories %}
{% if categories_list.first[0] == null %}
{% for category in categories_list %}
<li><a href="#{{ category | downcase | downcase | url_escape | strip | replace: ' ', '-' }}">{{ category | camelcase }} ({{ site.tags[category].size }})</a></li>
{% endfor %}
{% else %}
{% for category in categories_list %}
<li><a href="#{{ category[0] | downcase | url_escape | strip | replace: ' ', '-' }}">{{ category[0] | camelcase }} ({{ category[1].size }})</a></li>
@Phlow
Phlow / mailchimp-merge-tags-ansprache
Created November 28, 2015 12:02
Mailchimp IF ELSEIF Loop für die Ansprache der Empfänger
*|IF:ANSPRACHE = Familie|*
Liebe Familie *|LNAME|*
*|ELSEIF:ANSPRACHE = Ehepaar|*
Liebes Ehepaar *|LNAME|*
*|ELSEIF:ANSPRACHE = Frau|*
*|IFNOT:FNAME|*
Liebe Frau *|LNAME|*
*|ELSE|*
Liebe *|FNAME|*
*|END:IF|*
@Phlow
Phlow / automatic_post_excerpt_for_post_pages.liquid
Last active March 13, 2021 17:56
This include splits the content of {{ content }} into two parts if Jekyll finds an excerpt separator. This allows extra styling of the first part to enlarge the the fontsize of the teaser for example.
{% comment %}
#
# Explanation:
#
# This include splits the content of {{ content }} into
# two parts if Jekyll finds an excerpt separator. This allows
# extra styling of the first part to enlarge the the fontsize
# of the teaser for example.
#
# The excerpt separator can be defined directly in your
@Phlow
Phlow / jeykll-post-counter.liquid
Last active November 22, 2019 00:27
Counter: This code snippet just counts your jekyll posts and spits out the result
{% comment %}
*
* Counter: This include counts your jekyll posts
*
{% endcomment %}{% assign counter = 0 %}{% for item in site.posts %}{% unless item.published == false %}{% assign counter=counter | plus:1 %}{% endunless %}{% endfor %}{{ counter }}
@Phlow
Phlow / jekyll-sorted-category-for-loop-alphabetical-date.liquid
Last active March 12, 2022 14:18
Jekyll (Liquid) for loop to sort posts by category in alphabetical or date-based or similiar order.
{% comment %}
#
# Change date order by adding '| reversed'
# To sort by title or other variables use {% assign sorted_posts = category[1] | sort: 'title' %}
#
{% endcomment %}
{% assign sorted_cats = site.categories | sort %}
{% for category in sorted_cats %}
{% assign sorted_posts = category[1] | reverse %}
<h2 id="{{category[0] | uri_escape | downcase }}">{{category[0] | capitalize}}</H2>
@Phlow
Phlow / jekyll-loop-all-collections.liquid
Created December 26, 2015 13:20
Loop through all collections of a Jekyll website
{% for c in site.collections %}
{% assign docs=c[1].docs %}
{% for doc in docs %}
// do something
{% endfor %}
{% endfor %}