Skip to content

Instantly share code, notes, and snippets.

View anotheremily's full-sized avatar

emily anotheremily

  • Las Vegas, Nevada USA
View GitHub Profile
@anotheremily
anotheremily / phplint.sh
Created April 6, 2012 19:15
PHP Lint Bash Functions
function phplint() {
for f in `ls *.php`
do
php -l ${f}
done
}
function rphplint() {
for f in `find . -iname '*.php'`
do
@anotheremily
anotheremily / array_peek.php
Created September 2, 2011 14:46
array_peek
<?php
/**
* Peeks at the first element of an array. Optionally returns the first key
* if the 2nd parameter is set to true.
*
* @param Array $arr
* @param Boolean $returnKey
* @return Mixed $val
*/
function array_peek($arr, $key = false) {
@anotheremily
anotheremily / zend_autoreply_detection.php
Created April 8, 2011 15:57
Auto-reply detection in PHP (with Zend)
<?php
/**
* See if it's an autoreply
* $message is of type Zend_Mail_Message
*/
$autoreply = false;
try {
if ($message->{'X-Autoreply'}) {
$autoreply = true;
}
Name
Type
Description
Beard Bonus
Paul Buchheit
More Than Just The Gmail Guy
Paul's a CWRU grad. We put him on here to try to get him to give a talk or interview at the CWRU Hacker Society. So, Paul, if you see this please email [email protected]!
John McCarthy
ln -s /usr/lib/liblua5.1.so /usr/lib/liblua.so
@anotheremily
anotheremily / find-base64-occurences
Created December 6, 2010 22:25
hackers seem to like base64 encoding their php commands
#!/bin/bash
find . -name "*.php" -exec grep "base64" '{}' \; -print &> b64-detections.txt
find . -name "*.php" -exec grep "eval" '{}' \; -print &> eval-detections.txt
@anotheremily
anotheremily / getNearbyZipCodes.sql
Created November 24, 2010 19:16
Get nearby zip codes from a certain zip code.
-- I think I fixed all of the bugs, but there may be one.
-- Now I just need to see about some optimization
SELECT
n.city,
n.zip_code,
n.latitude,
n.longitude,
3958.75587 * c AS distance
FROM (
SELECT
@anotheremily
anotheremily / changelog.sh
Created November 19, 2010 16:54
Generates a list of files with changes
#!/bin/bash
# generates a list of files with changes
diff -r DIRECTORY1 DIRECTORY2 | grep ^diff | cut -d' ' -f3
@anotheremily
anotheremily / zyoung-yui-reset.css
Created October 19, 2010 20:48
Modified version of the YUI 3 Reset
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.2.0
build: 2676
Modified by zyoung
*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
#!/bin/bash
# the hack attempt inserts <ads> tags into files
find . -exec grep "<ads>" '{}' \; -print &> ads-detections
# most of the files tend to be .js.php
find . -print | grep ".js.php" &> js-php-detections