Skip to content

Instantly share code, notes, and snippets.

View mbijon's full-sized avatar
🎯
Focusing

Mike Bijon mbijon

🎯
Focusing
View GitHub Profile
@mbijon
mbijon / pivotal_export.php
Created May 25, 2011 23:37 — forked from anonymous/pivotal_export.php
Expose Mantis bugs for PivotalTracker-import
<?php
/*
Mantis -> PivotalTracker export script
Based on scripts from this support thread:
- http://community.pivotaltracker.com/pivotal/topics/synchronize_pivotal_tracker_with_mantis
To configure:
1.) Put this script in your Mantis root folder (one that contains 'core.php')
2.) Create an "Other" integration in Pivotal
3.) In the integration set a Mantis user/pass that has read rights on the project
@mbijon
mbijon / xss_clean.php
Last active November 1, 2022 03:23
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
<?php
/*
* XSS filter, recursively handles HTML tags & UTF encoding
* Optionally handles base64 encoding
*
* ***DEPRECATION RECOMMENDED*** Not updated or maintained since 2011
* A MAINTAINED & BETTER ALTERNATIVE => kses
* https://github.com/RichardVasquez/kses/
*
* This was built from numerous sources
@mbijon
mbijon / command.sh
Created October 29, 2011 18:30 — forked from felixge/command.sh
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
@mbijon
mbijon / fft.php
Last active February 17, 2024 03:46
Fast Fourier Transform in PHP
<?php
// !!! Warning: for reference, not debugged
###################################################################
# PHP_Fourier 0.03b
# Original Fortran source by Numerical Recipies
# PHP port by Mathew Binkley (binkleym@nukote.com)
###################################################################
@mbijon
mbijon / wordpress-plugin-api.php
Created November 2, 2011 00:38
WordPress plugin API sample-use
<?php
/*
Retrieve items from the WordPress.org plugin API
Original source: http://pastebin.com/7Ji8rD2P
Docs v1.0: http://dd32.id.au/projects/wordpressorg-plugin-information-api-docs/
Usage:
http://{host}/wordpress-plugin-api.php?page_start=9&per=20&pages=10&info=1
GET['page_start'] => Page-numer to start retreiving data on
@mbijon
mbijon / TCB_JSON_API.php
Created November 3, 2011 06:55 — forked from mikeschinkel/TCB_JSON_API.php
Creates JSON class for Tom C. Barret to load tickets via a RESTful API
<?php
/**
* Creates JSON class for Tom C. Barrett to load tickets via a RESTful API:
*
* @example:
*
* URL: http://example.com/api/ticket/12345
*
* @see:
*
@mbijon
mbijon / generate_update.sh
Created November 20, 2011 08:31 — forked from xentek/generate_update.sh
Generate the necessary sql statements to move a WordPress site from one environment to another
#!/usr/bin/env bash
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ "
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! "
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! "
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! "
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! "
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! "
@mbijon
mbijon / svn_deploy.php
Created December 22, 2011 23:09
Checkout & deploy from SVN to local path, in PHP (GPLv2)
$svn_address = "https://domain/";
$svn_user = "foo";
$svn_user = "foopass";
$web_path = "/var/www/foo.com/public_html/";
$temp_path = "/data/tmp/";
$backup_path = $path . "/data/backup/";
// Checkout SVN
$svn_command = "svn export " . $svn_address . " " . $temp_path "/ --username=" . $svn_user . " --password=";
echo $svn_command . "<br />";
@mbijon
mbijon / currency-to-float.php
Created March 17, 2012 01:19
Human-format currency $'s converted to machine floating points
<?php
/*
* Human-format currency $'s converted to machine floating points
*/
// Dollar amount via GET (not very secure)
$raw_dollar_amount = ( isset($_GET['dollar_amount']) ) ? htmlentities( $_GET['dollar_amount'], ENT_QUOTES, 'UTF-8' ) : FALSE;
if ( $raw_dollar_amount ) {
// Create a return value in case nothing done
$float_dollar_amount = $raw_dollar_amount;
@mbijon
mbijon / benchmark_wordpress_seo-auto-linker.php
Created September 18, 2012 08:57
Quick benchmarker for WordPress Plugin: SEO Auto Linker. For @danielbachhuber b/c it uses many preg_matches
<?php
/*
* Usage:
* 1. Paste into Debug Bar console and Run
* 2. Run it several times (just in case iTunes is running on your dev server)
*
* Benchmarking Alternatives:
* - Wrap the real SEO Auto Linker for wp-cli and replace the call to content()
* - Add this quick & dirty benchmark loop to Debug Bar
*