Skip to content

Instantly share code, notes, and snippets.

View criztovyl's full-sized avatar

Christoph Schulz criztovyl

View GitHub Profile
@criztovyl
criztovyl / gist-clone.sh
Last active July 13, 2018 18:34
Clones a GitHub Gist into an directory with the Gist's name.
#!/bin/bash
# Clones a GitHub Gist into an directory with the Gist's name.
# Copyright (C) 2016 Christoph "criztovyl" Schulz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@criztovyl
criztovyl / bandcamp_discography.sh
Last active August 7, 2016 16:00
Sorts a Bandcamp discography by release date
#!/bin/bash
# Utility for Bandcamp discographies
# Copyright (C) 2016 Christoph "criztovyl" Schulz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@criztovyl
criztovyl / monthdiff.sh
Created January 26, 2016 22:05
Calculates differences between months, also across years.
#!/bin/bash
# Script for calculating month differences
# Copyright (C) 2016 Christoph "criztovyl" Schulz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@criztovyl
criztovyl / gpl-init.sh
Last active July 1, 2016 14:01
Initializes files with GPL or adds it to existing files.
#!/bin/bash
# A small tool to init files with a GPL header.
# Copyright (C) 2015 Christoph "criztovyl" Schulz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@criztovyl
criztovyl / pimus.sh
Last active August 29, 2015 14:27
Opens remote cmus screen in current shell. Starts cmus if it's not running.
#!/bin/bash
pimus()
{
# Try to show cmus screen, start new cmus instance into cmus screen if not available
if ! screen -qr cmus; then
# Start new cmus into cmus screen
screen -mdS cmus cmus
# Wait for cmus socket (up to 5x5 seconds)
@criztovyl
criztovyl / ssj.sh
Last active August 29, 2015 14:25
Splits, sorts and joins a string by a separator
#!/bin/bash
# A Bash/Ruby script that splits, sorts and joins a string
# Copyright (C) 2015 Christoph "criztovyl" Schulz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@criztovyl
criztovyl / to_assoc.php
Last active August 29, 2015 14:24
Associates integer-indexed arrays
<?php
/*
Replace array indices with associative keys
Copyright (C) 2015 Christoph "criztovyl" Schulz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@criztovyl
criztovyl / bandcampwishlist.php
Last active August 27, 2018 00:06
Receives or displays a wishlist of a fan on bandcamp
<?php
/*
A small PHP script to display a bandcamp wishlist
Copyright (C) 2015 Christoph "criztovyl" Schulz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@criztovyl
criztovyl / dlextract.sh
Last active February 9, 2016 13:52
Downloads, extracts and removes a archive file.
# 2016 Christoph "criztovyl" Schulz
# No Copyright, too trivial.
dlextract() {
file=$1
command=$2
keep=$3
wget $file && $command `basename $_` && [ "$keep" ] || rm -f $_
}
dlunzip(){ dlextract "$1" "7z x" $2; }
dluntar(){ dlextract "$1" "tar -xaf" $2; }
@criztovyl
criztovyl / yesdo.sh
Last active August 29, 2015 14:21
Ask a Yes/No question and executes an action dependent on the answer
#!/bin/bash
# Asks a user a Yes/No question and executes actions dependent on the answer.
# Copyright (C) 2015 Christoph "criztovyl" Schulz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,