The below file is REALLY OLD!
Instead, check out the library I put together at https://github.com/navarr/Sockets
The below file is REALLY OLD!
Instead, check out the library I put together at https://github.com/navarr/Sockets
<?php | |
// | |
// | |
//// Decide how many children to use. | |
$children = 10; | |
// Load Predis. If using PHP 5.2, call new Predis_Client() instead. | |
$predis = new Redis(); |
<?php | |
$redis = new Redis(); | |
$redis->connect('127.0.0.1', 6379); | |
for ($i = 0; $i < 100; $i++) { | |
$start = microtime(true); | |
for ($j = 0; $j < 10000; $j++) { | |
$key = sprintf("key:%05d", $j); | |
/* GET or SET */ |
#!/bin/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
<?php | |
/** | |
* | |
* The MQTTClient class allows you to connect to an MQTT message broker and publish messages | |
* @author rob.s.smart@gmail.com | |
* | |
* Example use | |
* $client = new MQTTClient("robphptest","realtime.ngi.ibm.com",1883); | |
* $client->connect(); |
import json | |
import requests | |
# Authentication for user filing issue (must have read/write access to | |
# repository to add issue to) | |
USERNAME = 'CHANGEME' | |
PASSWORD = 'CHANGEME' | |
# The repository to add this issue to | |
REPO_OWNER = 'CHANGEME' |
private static function iv() | |
{ | |
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); | |
return mcrypt_create_iv($iv_size, MCRYPT_RAND); | |
} | |
static function encrypt($str, $key32) | |
{ | |
# Prepend 4-chars data hash to the data itself for validation after decryption | |
$str = substr(md5($str), 0, 4).$str; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Handlebars Partials Example</title> | |
</head> | |
<body> | |
<h1>Handlebars Partials Example!</h1> | |
<div id="list"> | |
</div> |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000