Skip to content

Instantly share code, notes, and snippets.

View AaronTraas's full-sized avatar

Aaron Traas AaronTraas

View GitHub Profile
@AaronTraas
AaronTraas / gist:9252196
Created February 27, 2014 15:23
My .agignore -- mostly ignoring binaries
.git/
.hg/
images/
img/
tmp/
*.tags*
*.tmp*
*.old
*.pdf
*.png
@AaronTraas
AaronTraas / .htaccess
Created January 15, 2015 19:31
PHP simple directory listing scripts
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php?/$1 [L]
@AaronTraas
AaronTraas / test_email_credentials.py
Last active August 29, 2015 14:23
[Python] test email credentials
#!/usr/bin/python
from smtplib import SMTP
from email.MIMEText import MIMEText
SERVER = "<SMTP_server>"
USERNAME = "<SMTP_user_name>"
PASSWORD = "<SMTP_password>"
DESTINATION = "<destination_email_address>"
@AaronTraas
AaronTraas / instagram.php
Last active November 10, 2015 02:01
Instagram auth test
<!DOCTYPE html>
<html lang="en">
<head>
<title>Instagram Auth Test</title>
</head>
<body>
<h1>Instagram Auth Test</h1>
<?php
// Register your app here: http://instagram.com/developer/
$client_id = 'YOUR_CLIENT_ID';
@AaronTraas
AaronTraas / ansible_vagrant.sh
Created December 14, 2015 21:33
Install Homebrew, and use Homebrew to install Ansible and Vagrant and Virtualbox
#!/bin/sh
# install .bash_profile
curl https://raw.githubusercontent.com/AaronTraas/osx-setup/master/bash_profile > ~/.bash_profile
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install caskroom
brew tap phinze/cask && brew install brew-cask
@AaronTraas
AaronTraas / gist:9533041
Last active December 13, 2018 10:08
Updated AJAX email mailer PHP script
<?php
// My modifications to mailer script from:
// http://blog.teamtreehouse.com/create-ajax-contact-form
// Added input sanitizing to prevent injection
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form fields and remove whitespace.
$name = strip_tags(trim($_POST["name"]));
$name = str_replace(array("\r","\n"),array(" "," "),$name);
@AaronTraas
AaronTraas / stupid_sort.py
Last active March 3, 2023 17:07
Stupid Sort - sorting algorinthm with O(n!!)
import random
# Precondition: list is a list of numbers
def is_ordered(list):
last = None
for el in list:
if last is not None and el < last:
return False
last = el
return True