Skip to content

Instantly share code, notes, and snippets.

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

Moritz »mo.« Sauer Phlow

🐙
🎛️ 🔊
View GitHub Profile
@Phlow
Phlow / #Liquid #Jekyll List Archive by Year
Last active August 29, 2015 14:19
#Jekyll Archivseite nach Jahren sortiert
{% comment %}
*
* List Archive by Year
*
{% endcomment %}
<section id="archive">
<h3>This year's posts</h3>
{%for post in site.posts %}
{% unless post.next %}
<ul class="this">
@Phlow
Phlow / Loop through all pages of all collections
Created July 28, 2015 17:36
Loop through all pages of all collections
{% comment %}
#
# Loop through all pages of all collections
#
{% endcomment %}
{% for c in site.collections %}
{% assign docs=c[1].docs %}
{% for doc in docs %}
// do something
{% endfor %}
@Phlow
Phlow / batch_download.sh
Last active August 29, 2015 14:27
Batch Download via Terminal with explanation
#
# 1. Download file › batch_download.sh
# 2. Edit file › URLs for wget to download
# 3. With -O you can rename the output file
# 4. Change permissions of file $ chmod 755 batch_download.sh
# 5. Start the batch $ ./batch_download.sh
#
wget https://archive.org/compress/kpu008 -O kpu008.zip
wget https://archive.org/compress/kpu009 -O kpu009.zip
@Phlow
Phlow / rename-files.sh
Created August 15, 2015 09:10
A collection of methods to rename files in terminal
#
# Rename multiple files and replace name with number and prefix
# %02 › digits of numbers (increase when lots of files)
#
# counter=1
# for i in *.*
# do new=$(printf "%02d.jpg" "$counter")
# mv -- "$i" "screenshot-realaudio-$new"
# let counter=counter+1
# done
@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 / rename-files-and-replace.sh
Last active September 30, 2015 12:08
Rename files and replace text with new text
# Rename file and replace OLDTEXT with NEWTEXT
# for filename in *.jpg; do mv "$filename" "${filename//OLDTEXT/NEWTEXT}"; done
# replace large with nothing
for filename in *.jpg; do mv "$filename" "${filename//large/}"; done
for filename in *.xml; do mv "$filename" "${filename//_meta.xml/.md}"; done
@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 / 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 / .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 / 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|*