Skip to content

Instantly share code, notes, and snippets.

@samurailink3
samurailink3 / Backup-Saves.sh
Created February 25, 2013 09:39
This file can be used to backup a folder to RackSpace Cloud Files. In this current configuration, it can be used (with a properly configured emulationstation) to backup game emulation saves automatically via a cronjob.
#!/bin/bash
UPLOAD_TO_CONTAINER="$HOSTNAME-Saves" #adjust it as you like
export CLOUDFILES_USERNAME= # THIS IS YOUR RACKSPACE USERNAME #
export CLOUDFILES_APIKEY= # THIS IS YOUR RACKSPACE API KEY #
export PASSPHRASE=
export BACK_THIS_UP=/home/pi/saves
duplicity --no-encryption $BACK_THIS_UP cf+http://${UPLOAD_TO_CONTAINER}
@samurailink3
samurailink3 / examplesite
Last active December 14, 2015 15:49
Apache VirtualHost Configuration Example (Rewrite Enabled) File goes in /etc/apache2/sites-enabled/
<VirtualHost *:80>
ServerAdmin webmaster@email.com
ServerName sitename.example.com
DocumentRoot /var/www/siteroot
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/siteroot>
@samurailink3
samurailink3 / rails.sh
Last active December 15, 2015 19:29
Debian Ruby on Rails (Ruby 1.9.3 - Rails 3.2.1) Developer Quick Launch - These files are used to quickly get a Debian system up an running after a clean install. Please run the script as a sudo user. You can remove the sudo access after the install. (Tested on Squeeze and Wheezy)
# Thanks to http://xyzpub.com/en/ruby-on-rails/3.2/rails3-install-debian.html
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion python
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm autolibs enable
rvm install 1.9.3
gem update
gem install rails --version '~> 3.2.1'
echo "source \$(rvm 1.9.3 do rvm env --path)" >> $HOME/.bashrc
@samurailink3
samurailink3 / post-receive
Created April 8, 2013 10:12
Octopress Post-Receive
#!/bin/bash
# Make sure you have $HOME/git/working created already
# Put this file in a bare repository, configure Octopress for local deployment.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
GEM_PATH=$GEM_PATH:$HOME/.gems
PATH=$PATH:$HOME/.gems/bin
site=www.example.com
@samurailink3
samurailink3 / .htaccess
Created April 8, 2013 10:13
Apache2 www-rewrite file. Put file in root www folder. This will add 'www' to each website.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
@samurailink3
samurailink3 / php.ini
Created April 8, 2013 14:27
My default PHP.ini for web hosts
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@samurailink3
samurailink3 / proftpd.conf
Created April 15, 2013 13:53
My default proftpd.conf file.
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 on
@samurailink3
samurailink3 / passwd
Created April 15, 2013 13:59
/etc/passwd example file to disallow interactive logon (Good for FTP servers)
bob:x:0:0:root:/home/bob:/bin/bash
# The above user can log in interactively, and their home folder is in the usual location
alice:x:1000:1000:,,,:/var/www/www.example.com:/bin/false
# The above user can't log in interactively, and their home folder is set to their public website folder.
@samurailink3
samurailink3 / 50unattended-upgrades
Created April 24, 2013 00:28
Enable automatic security updates on Debian.
APT::Periodic::Enable "1";
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
// Automatically upgrade packages from these (origin, archive) pairs
Unattended-Upgrade::Allowed-Origins {
@samurailink3
samurailink3 / unlock-ps.bat
Last active April 11, 2020 11:37
Command line batch files for unlocking user accounts. For the No-PowerShell version you will need the user's Distinguished Name and an admin account that can unlock accounts. For the PowerShell version, you will need the user's sAMAccountName and an admin account that can unlock accounts.The `unlock-ps.bat` file is easier to work with, but I inc…
@echo off
REM ABOUT: This file will unlock a user account that you specify on the command line.
REM REQUIREMENTS: Powershell with ActiveDirectory Module; Active Directory Account with Unlock permissions.
echo "This file will unlock a user who's username (sAMAccountName) you specify."
SET /P ADDomain=Your domain name:
SET /P AdminUser=Your admin username:
SET /P UserToUnlock=Username you would like unlocked: