Skip to content

Instantly share code, notes, and snippets.

Avatar

Harry Mustoe-Playfair manticorp

View GitHub Profile
@kamermans
kamermans / result.txt
Created Oct 26, 2015
PHP time() vs microtime() vs microtime(true) benchmark
View result.txt
PHP
--------------------------------------------------------------
Total Iterations: 10,000,000
time(): 0.73976612091064 seconds (13,517,785/sec)
microtime(): 4.2245488166809 seconds (2,367,116/sec)
microtime(true): 1.2555038928986 seconds (7,964,929/sec)
HHVM
--------------------------------------------------------------
Total Iterations: 10,000,000
@tonyhb
tonyhb / Helper_Data.php
Last active May 30, 2022
New prepareIndexdata method for the CatalogSearch Helper in Magento (to integrate with Sphinx)
View Helper_Data.php
<?php
// Helper/Data.php
...
public function prepareIndexdata($index, $separator = ' ', $entity_id = NULL)
{
$_attributes = array();
@kamermans
kamermans / mysql_countries.sql
Created Dec 7, 2011
MySQL Dump - continents and countries with 2 and 3 char codes, names and full names - Braintree compatible as of Dec 2011
View mysql_countries.sql
/**
* Continents and Countries MySQL Tables compiled from Wikipedia, Braintree Payments documentation
* and a couple other places I don't recall at the moment. This data is compatible with the Braintree
* Payment API as of Dec 2011
*
* Compiled by Steve Kamerman, 2011
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
@kamermans
kamermans / fail2ban-allstatus.sh
Created Jul 11, 2011
Show status of all fail2ban jails at once
View fail2ban-allstatus.sh
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done