This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP class to convert Latitude & Longitude coordinates into UTM & Lambert Conic Conformal Northing/Easting coordinates. | |
* | |
* This class encapsulates the methods for representing a geographic point on the earth in three different coordinate systema. Lat/Long, UTM and Lambert Conic Conformal. | |
* | |
* Code for datum and UTM conversion was converted from C++ code written by Chuck Gantz ([email protected]) from http://www.gpsy.com/gpsinfo/geotoutm/ | |
* This code was converted into PHP by Brenor Brophy ([email protected]) and later refactored for PHP 5.3 by Hans Duedal ([email protected]). | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
/usr/bin/find /var/www -path "/var/www/*/wwwroot/*" \ | |
\( -type f ! -perm 660 -print0 -exec chmod 660 {} \; -exec sh -c exit 1 \; \) -or \ | |
\( -type d ! -perm 770 -print0 -exec chmod 770 {} \; -exec sh -c exit 1 \; \) -or \ | |
\( \( ! -user ftp -or ! -group www \) -print0 -exec chown -f ftp:www {} \; \) > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var redis = require("redis"), client = redis.createClient(6379,'127.0.0.1'); | |
// Benchmark params | |
var data = 'O:10:"SmsRequest":5:{s:2:"id";i:550845359;s:6:"sender";s:10:"OnlineCity";s:7:"message";s:140:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus blandit faucibus magna, vitae accumsan orci iaculis sed. Morbi cras amet.";s:10:"recipients";a:1:{i:0;i:4526159917;}s:10:"dataCoding";i:0;}'; | |
var n = 20000; | |
var start; | |
var lastOp; | |
client.on("error", function (err) { | |
console.log("Error " + err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var thrift = require('thrift'); | |
var test = require('./gen-nodejs/test.js'), | |
ttypes = require('./gen-nodejs/test_types'); | |
var connection = thrift.createConnection('localhost', 9090), | |
client = thrift.createClient(test, connection); | |
connection.on('error', function(err) { | |
console.error(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function palindromeTest($i) { | |
preg_match_all('/([\\x41-\\x5A\\x61-\x7A])|([\\xC0-\\xDF].)|([\\xE0-\\xEF]..)|([\\xF0-\\xFF]...)]/',$i,$m); | |
$a = mb_strtolower(implode('',$m[0]),'UTF-8'); | |
$b = mb_strtolower(implode('',array_reverse($m[0])),'UTF-8'); | |
return ($a == $b); | |
} | |
var_dump(palindromeTest('Syy hyökätä: köyhyys!')); // true | |
var_dump(palindromeTest('Syy hyäkötä: köyhyys!')); // false | |
var_dump(palindromeTest('Selmas lakserøde garagedøre skal samles')); // true | |
var_dump(palindromeTest('a€b€a')); // true (U+20AC test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iconv.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/errno.h> | |
using namespace std; | |
char * | |
convert(const char *from_charset, const char *to_charset, const char *input) { | |
size_t inleft, outleft, converted = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Uses third party site ipnr.dk, thanks a lot | |
if (isset($_SERVER["SERVER_ADDR"])) echo "Local Address: ".$_SERVER["SERVER_ADDR"]."<br/>\nRemote: "; | |
if (extension_loaded('curl')) { | |
$c = curl_init('http://ipnr.dk/'); | |
curl_setopt($c,CURLOPT_USERAGENT,'curl/0 (PHP) libcurl/0'); | |
curl_exec($c); | |
} else { | |
echo "no cURL extension\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2011 OnlineCity | |
* Licensed under the MIT license, which can be read at: http://www.opensource.org/licenses/mit-license.php | |
* @author [email protected] & [email protected] | |
*/ | |
#include "hexdump.h" | |
void oc::tools::hexdump(std::ostream &out, const boost::shared_array<uint8_t> &bytes, size_t length) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <stdlib.h> | |
using namespace std; | |
int main(int argc, char** argv) { | |
if (argc != 2) { | |
cout << "Wrong number of arguments: " << argc << endl; | |
return 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Less than 80 chars | |
___________ | |
< text here > | |
----------- | |
two lines | |
________________________________ | |
/ text goes here text goes here \ |
OlderNewer