This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validate($upload){ // Must be a $_FILES array | |
if($upload['size'] == 0) return "Image not uploaded correctly."; | |
if($upload['size'] > 2097152){ // Measured in bytes, this is equal to 2MB | |
$filesize = $upload['size']/1048576; // Converts from bytes to Megabytes | |
return "The image you uploaded has a filesize that is too large. Please reduce your image to < 2MB. It is currently ".$filesize."MB."; | |
} | |
if(($upload['type'] != "image/gif" || "image/jpeg" || "image/png") || ($this->imageinfo['mime'] != "image/gif" || "image/jpeg" || "image/png")) | |
return "Uploads of that file type are not allowed. You need a jpg, png, or gif image."; | |
$blacklist = array(".php", ".phtml", ".php3", ".php4", ".ph3", ".ph4"); | |
foreach ($blacklist as $item) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function duplicate_fixer($fname, $count = 0, $old_fname = null){ | |
if($count != 0){ | |
$boom = explode(".", $old_fname); | |
$boom[count($boom)-2] = $boom[count($boom)-2].$count."."; | |
$fname = implode($boom); | |
} | |
if(file_exists($fname)){ | |
if($count == 0) $old_fname = $fname; | |
$count++; | |
$fname = duplicate_fixer($fname, $count, $old_fname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Modified Version of the XAMPP launching script to use a system MongoDB install as opposed to MySQL | |
# Tested on Ubuntu 10.10 | |
# | |
# Copyright (c) 2011, Ben Kulbertis | |
# Author: Ben Kulbertis <[email protected]> | |
# | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT=$1 | |
shift | |
bash -s < <(curl -sL $SCRIPT) $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
xrandr --output DVI-I-3 --off | |
env LD_LIBRARY_PATH="/usr/lib32/:/usr/lib/" WINENOPULSE=1 wine ~/.wine/dosdevices/c\:/Program\ Files/StarCraft\ II/Starcraft\ II.exe | |
while [ "$(pidof SC2.exe)" -o "$(pidof Blizzard\ Launcher.exe)" ]; do | |
sleep 1 | |
done | |
xrandr --output DVI-I-3 --auto --right-of DVI-I-2 | |
wineserver -k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./pshutdown.sh 1234 | |
# Or: ./pshutdown.sh $(pidof -s someprocess) | |
pid=$1 | |
if [ -z "$pid" ] | |
then | |
echo "This script shuts down the system when a certain process exits. Please pass a process id as an argument to shut the system down when it exits." 1>&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: This is the name (in Virtualbox) of the VM you want to back up. Pass it as an argument or change the '%1' below to the VM name. | |
set vmname=%1 | |
set bakroot=D:\VM Backups | |
:: Get current date - from http://stackoverflow.com/a/203116 | |
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%a-%%b-%%c) | |
set /p start=The %vmname% VM is about to be backed up. Do you wish to continue (Y/[N])? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
interfaces=$(ip link | cut -d ":" -f 1-2 | sed 'n; d') | |
echo -e "Available Interfaces:\n$interfaces" | |
read -p "Please choose an interface: " choice | |
if [ "$choice" -ge 1 -a "$choice" -le $(echo "$interfaces" | wc -l) ]; then | |
interface=$(echo "$interfaces" | sed "${choice}q;d" | cut -d ":" -f 2 | sed 's/ //g') | |
sed "s/eth0/$interface/g" /etc/netctl/examples/ethernet-dhcp > /etc/netctl/ethernet-dhcp | |
echo "Now enabling the $interface interface..." | |
netctl start ethernet-dhcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CHANGE THESE | |
auth_email="[email protected]" | |
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings | |
zone_name="example.com" | |
record_name="www.example.com" | |
# MAYBE CHANGE THESE | |
ip=$(curl -s http://ipv4.icanhazip.com) |