Skip to content

Instantly share code, notes, and snippets.

@rickowski
rickowski / oc-activityreader.sh
Created June 1, 2016 07:18
Read all activity from owncloud mysql database
#!/bin/bash
# Copyright © 2016 Ole Rickowski
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
# Path to the owncloud installation (no ending slash)
OC_PATH="/var/www/owncloud"
@rickowski
rickowski / randomfilerenamer.py
Last active December 16, 2022 14:09
Python script to rename every file in a given folder to a random name, including the original file extension.
#!/usr/bin/python3
# Copyright © 2015 Ole Rickowski
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
import os,sys,random,string
# Print help
@rickowski
rickowski / easygpg.sh
Created October 27, 2015 12:48
Encrypt files easy and basic with gpg
#!/bin/bash
# Copyright © 2015 Ole Rickowski
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
main(){
# Check if target file exists
@rickowski
rickowski / print_warn_success.sh
Created September 22, 2015 09:22
Print red and green messages in bash. Example.
#!/bin/bash
function prnt_green(){
echo -e "\e[1;32m$1\e[0m"
}
function prnt_red(){
echo -e "\e[1;31m$1\e[0m"
}
@rickowski
rickowski / read_arguments.sh
Created September 17, 2015 14:15
Parse arguments in a bash script. Example.
#!/bin/bash
#Are arguments given?
if [ $# -eq 0 ]; then
#No... Exit.
echo "Arguments required!"
exit 1
fi
#Use getopts to parse arguments