Skip to content

Instantly share code, notes, and snippets.

@StudioLE
StudioLE / backup-srv.sh
Last active August 29, 2015 14:12
Backup directories locally and to S3
#!/bin/bash
echo "LE Backup Wizard v2"
echo "Which directory would you like to backup?[\"n\" to abort]"
ls /srv/
read name
if [ $name = n ]
then
echo "Aborted"
@StudioLE
StudioLE / backup-sql.sh
Last active August 29, 2015 14:12
Backup MySQL and upload to S3
#!/bin/bash
echo "LE Database Backup Wizard v2"
echo "Which database would you like to backup? [\"n\" to abort]"
read database
if [ $database = n ]
then
echo "Aborted"
exit
@StudioLE
StudioLE / mysql.conf
Created January 4, 2015 23:24
MySQL config for backup-sql.sh
[mysqldump]
user=USERNAME
password=PASSWORD
@StudioLE
StudioLE / minecraft-backup.sh
Created January 4, 2015 23:26
Simple script to backup a minecraft server
#!/bin/bash
echo "Backup LE-CRAFT"
echo "Ensure you have set /save-off or /stop"
echo "Are you ready? [y/n]"
read execute
if [ $execute = y ]
then
@StudioLE
StudioLE / server.cmd
Created February 21, 2015 19:01
Launch a Node.js http-server
http-server -a localhost -p 1337 -c-1 -o
@StudioLE
StudioLE / backup-s3.sh
Last active August 29, 2015 14:16
Tar and Backup to AWS S3
#!/bin/bash
echo "LE Tar and S3 Wizard v1"
echo "Which directory would you like to tar? [\"n\" to abort]"
ls /srv/lib/backups/dir/
read file
if [ $file = n ]
then
echo "Aborted"
@StudioLE
StudioLE / registerWaterlockUser.js
Last active August 29, 2015 14:18
Register a new using Sails.js + Waterlock
User.create(data, function(err, user) {
if(err) {
console.log(err)
return false
}
waterlock.engine.attachAuthToUser({
email: data.email,
password: data.password
}, user, function(err, user) {
sails.log('Added user ' + user.name)
@StudioLE
StudioLE / gist:e6c254f02aa8d145562f
Created April 4, 2015 14:57
Hide changes to files in git but preserve the original file in the repository
# To hide future changes
git update-index --assume-unchanged filepath
# To unhide changes
git update-index --no-assume-unchanged filepath
@StudioLE
StudioLE / app.js
Last active August 29, 2015 14:24
Make AngularJS $http service behave like jQuery.ajax()
// From: http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/
// Your app's root module...
angular.module('MyModule', [], function($httpProvider) {
// Use x-www-form-urlencoded Content-Type
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
/**
* The workhorse; converts an object to x-www-form-urlencoded serialization.
* @param {Object} obj
@StudioLE
StudioLE / update.sh
Last active August 29, 2015 14:26
Chain apt-get update > upgrade > dist-upgrade > autoremove
#!/bin/bash
echo "apt-get update & upgrade wizard"
echo "Would you like to assume yes? [y/n]"
read input_force
if [ $input_force = y ]
then
force="--yes"
fi