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 / 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 / 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 / .gitignore
Created Sep 29, 2012 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
View .gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@mbijon
mbijon / jsdiff.js
Created Oct 9, 2012
File-diff algorithm: diffString( String oldFile, String newFile ) calculates the differences between two strings and exports a diff-marked HTML file. Implemented by John Resig, http://ejohn.org/projects/javascript-diff-algorithm/, based on the paper: P. H
View jsdiff.js
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
*
* Released under the MIT license.
*
* More Info:
* http://ejohn.org/projects/javascript-diff-algorithm/
*/
@mbijon
mbijon / WP_rolling_transient.php
Created Nov 4, 2012
Rolling expiration with WordPress Transients: Each time the transient is accessed the expiration is delayed. Intended for rate-limiting (be careful not to share a transient btw multiple users). Might work better for micro-caching in the event a flood is n
View WP_rolling_transient.php
$call_limit = 350; // API calls (in an hour)
$time_limit = 60 * 60; // 1 hour (in seconds)
$transient_name = $host . "_rate_limit"; // Using their host name as the unique identifier
// Check to see if there are any transients that match the name, if not create a new one
if ( false === ( $calls = get_transient( $transient_name ) ) ) {
$calls[] = time();
set_transient( $transient, $calls, $time_limit ); // Use an array of time() stamps for rolling effect
} else {
// There is already a transient with this name
View wp-hackerslist-media-manager-ref.php
Date: Thu, 20 Dec 2012 16:28:50 -0500
From: Daryl Koopersmith <koop@wordpress.org>
Subject: Re: [wp-hackers] Javascript bind event for 3.5's new
uploader?
To: wp-hackers@lists.automattic.com
Message-ID: <DB193711A3AC46F1AA76AAE5940586BA@gmail.com>
Content-Type: text/plain; charset="utf-8"
> I'm trying to add an action when the uploader is displayed, but I
> can't seem to call the .on or .bind from external code.
View README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
    • apache's home directory is /var/www/
You can’t perform that action at this time.