Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#by Nate Flink
mysqldump -u $2 -p$3 --extended-insert=false -h $4 $1 > $5
MINSIZE=3
ACTSIZE=$(du -k $5 | cut -f 1)
if [ $ACTSIZE -le $MINSIZE ]; then
echo "Error: the database backup is ${ACTSIZE} kilobytes, needs to be at least ${MINSIZE}"
exit 1
@nateflink
nateflink / addmysqluser.sh
Last active November 10, 2024 05:08
A bash script that adds a mysql user, and creates a database with the same name as the user and echos the generated password
#!/bin/bash
#By Nate Flink
# Adds a mysql user, and creates a database with the same name as the user and echos the generated password
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "Usage: ./$0 [mysql db username] [mysql user password] [new identifier] [optional password]"
exit 1
fi
@nateflink
nateflink / gist:5199461
Created March 19, 2013 19:45
Why use a Wordpress theme when you can do all the work yourself from scratch? A Bash script to create empty files for all the reserved files for a standard theme, with a comment about what that file does.
echo -e "/*\nTheme Name: Custom Theme\nTheme URI: http://codex.wordpress.org/Theme_Development\nDescription: This is a custom theme\nAuthor: Nate Flink\nAuthor URI: http://nateflink.com/\nVersion: 1.0\nTags: custom, theme, awesome\n\nLicense:\nLicense URI:\n\nGeneral comments (optional).\n\nThe main stylesheet. This must be included with your Theme, and it must contain the information header for your Theme.*/" > style.css ;\
echo -e "/*The rtl stylesheet. This will be included automatically if the website's text direction is right-to-left. This can be generated using the the RTLer plugin.*/" > rtl.css ;\
echo -e " <?php /*The main template. If your Theme provides its own templates, index.php must be present. */ ?>" > index.php ;\
echo -e " <?php /*The comments template. */ ?>" > comments.php ;\
echo -e " <?php /*The front page template, it is only used if you use a static front page. */ ?>" > front-page.php ;\
echo -e " <?php /*The home page template, which is the front page by default. If you use a static fr