Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
busy, busy

Mike Bijon mbijon

🕶️
busy, busy
View GitHub Profile
@mbijon
mbijon / pivotal_export.php
Created May 25, 2011 — forked from anonymous/pivotal_export.php
Expose Mantis bugs for PivotalTracker-import
View pivotal_export.php
<?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 Aug 26, 2021
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
View xss_clean.php
<?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 Oct 29, 2011 — forked from felixge/command.sh
Bash stuff for fighting a weak DOS attack
View command.sh
# 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 Aug 7, 2020
Fast Fourier Transform in PHP
View fft.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 Nov 2, 2011
WordPress plugin API sample-use
View wordpress-plugin-api.php
<?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 Nov 3, 2011 — forked from mikeschinkel/TCB_JSON_API.php
Creates JSON class for Tom C. Barret to load tickets via a RESTful API
View TCB_JSON_API.php
<?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 Nov 20, 2011 — forked from xentek/generate_update.sh
Generate the necessary sql statements to move a WordPress site from one environment to another
View generate_update.sh
#!/usr/bin/env bash
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ "
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! "
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! "
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! "
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! "
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! "
@mbijon
mbijon / svn_deploy.php
Created Dec 22, 2011
Checkout & deploy from SVN to local path, in PHP (GPLv2)
View svn_deploy.php
$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 Mar 17, 2012
Human-format currency $'s converted to machine floating points
View currency-to-float.php
<?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 Sep 18, 2012
Quick benchmarker for WordPress Plugin: SEO Auto Linker. For @danielbachhuber b/c it uses many preg_matches
View benchmark_wordpress_seo-auto-linker.php
<?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
*