Skip to content

Instantly share code, notes, and snippets.

<?php
// STEP 1: read POST data
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// Instead, read raw POST data from the input stream.
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Google (unofficial) Weather API Helper
*
* @author Kemal Delalic <kemal.delalic@gmail.com>
*/
class Weather {
protected static $_days = array(
'Mon' => 'Monday',
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sun Feb 19 04:03:37 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
diff --git a/system/core/Kohana.php b/system/core/Kohana.php
index 271f917..287c271 100644
--- a/system/core/Kohana.php
+++ b/system/core/Kohana.php
@@ -722,7 +722,7 @@ final class Kohana {
if (ob_get_level() >= self::$buffer_level)
{
// Set the close function
- $close = ($flush === TRUE) ? 'ob_end_flush' : 'ob_end_clean';
+ $close = ($flush === TRUE) ? 'ob_end_flush' : 'Kohana::_ob_end_clean';
<?php
######################################################################
# Phonehome script to obtain IP of home router
#
# Call with wget from your internal machine
# with the command:
# wget -t 10 http://yourwebsite/phonehome.php?c=1234&cmd=1 -O /dev/null
#
######################################################################
$SY = array();
#!/bin/bash
######################################################################
# Raspberry Pi
#
# Gross Script by Dweeber (Kevin Reed) <dweeber.dweebs@gmail.com>
# V1.0 2012-09-19
#
# Use the vcgencmd to obtain the Temp of the SOC
# then calculates the F value using bc.
#
@swooningfish
swooningfish / howmany.php
Created January 16, 2013 21:36
work out how many days weeks months have passed from a date
<?php
$days = floor((time() - strtotime("1-Dec-2012"))/86400);
$realWeeks = $days / 7;
$weeks = floor($realWeeks);
$months = floor($days / 28);
print("$days days have passed.<br/>\n");
print("$weeks weeks have passed.<br/>\n");
print("$realWeeks weeks have passed.<br/>\n");
print("$months months have passed.<br/>\n");
?>
@swooningfish
swooningfish / space_summary.php
Last active December 10, 2015 22:49
PHP script that that can email space summery. Best run from php-cli
#!/usr/bin/php
<?php
/**
* PHP Script to email space summery
*
* Options for mail, webfiles, database hosted on a server
*
* LICENSE: GPL 2.0 http://opensource.org/licenses/GPL-2.0
*
@swooningfish
swooningfish / kohana_db_escape.php
Created January 9, 2013 11:11
This removes the db escaping of kohana 2.x
<?
$config = Kohana::config('database.default');
$config['escape'] = FALSE;
$db = new Database($config);
$db->select("DISTINCT CONCAT(city, state, country) location");
// .. run query stuff..
?>
find . | xargs grep 'string' -sl
find . -iname '*php' | xargs grep 'string' -sl
find . -name *.php | grep -lir "string" *
find . -name *.php | grep -lir "string" *