Skip to content

Instantly share code, notes, and snippets.

@aaronhurt
aaronhurt / curltest.c
Last active February 13, 2025 15:51
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* License:
*
* This code is licensed under MIT license
* https://opensource.org/licenses/MIT
*
<?php
/**
* Example with all methods and default keys:
*
* $crypt = new phpCrypt;
*
* $crypt->cipher = "blowfish";
* printf("crypted == %s\ndecrypted == %s\n\n", ($crypted = $crypt->encrypt("hello world")), $crypt->decrypt($crypted));
*
* $crypt->cipher = "xor";
@aaronhurt
aaronhurt / cymru-lookup.php
Last active April 22, 2017 21:50
testing the cymru netcat access
<?php
/* test host list */
$hostlist = array(
'96.4.1.22',
'207.191.191.90',
'8.8.8.8'
);
/* do the lookup */
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <[email protected]>
* @revision Carlos Guimarães <[email protected]>
* @version Wed Mar 12 13:00:00 EDT 2014
*/
<?php
if (php_sapi_name() !== 'cli') {
die('This script may only be run from the command line.' . "\n");
}
if ($argc < 2) {
die('Usage: ' . $argv[0] . ' <encryption key>' . "\n");
}
<?php
/**
* Generate rfc compliant v3, v4 and v5 uuids
* @see http://www.php.net/manual/en/function.uniqid.php#94959
* @param int $type uuid version to generate (3, 4 or 5)
* @param string $namespace namespace for v3 and v5 uuids (default null)
* @param string $name name string for v3 and v5 uuids (default null)
* @return string|false generated uuid or false on failure
* @internal
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <[email protected]>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable
@aaronhurt
aaronhurt / pure-php-uuid.php
Created June 4, 2013 19:33
uuid generation in pure php
<?php
/* generate rfc compliant v3,v4 and v5 uuids
* http://www.php.net/manual/en/function.uniqid.php#94959
* $type -> uuid version to generate (3, 4 or 5)
* $namespace -> namespace for v3 and v5 uuids
* $name -> string for v3 and v5 uuids
*/
function generate_uuid($type, $namespace = null, $name = null) {
switch($type) {