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
#!/usr/bin/perl | |
my $datestring = prettydate(); | |
print $datestring; | |
# usage: $string = prettydate( [$time_t] ); | |
# omit parameter for current time/date | |
sub prettydate { | |
@_ = localtime(shift || time); | |
return(sprintf("%04d-%02d-%02d %02d:%02d", $_[5]+1900, $_[4]+1, $_[3], @_[2,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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <netinet/tcp.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <netinet/in.h> |
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/bash | |
FILE1="file1.csv" | |
FILE2="file2.csv" | |
for i in `cat ${FILE1} | cut -d, -f 2`; | |
do | |
COUNT=`grep -c "${i}" ${FILE2}` | |
echo "${i} has ${COUNT} matches." | |
done |
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/bash | |
curl -F "upload=@/path/to/file" -F "press=OK" URL |
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/bash | |
FROM=$1 | |
TO=/Users/user/Documents/phpdoc/$2 | |
if [ $# == 2 ]; | |
then | |
echo "Generating..." | |
phpdoc -d $FROM -t $TO | |
else |
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 | |
function HTTP_Request($url) { | |
$ch=curl_init(); | |
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); | |
curl_setopt($ch,CURLOPT_VERBOSE,1); | |
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); | |
curl_setopt($ch,CURLOPT_URL,$url); | |
$result=curl_exec($ch); | |
curl_close($ch); |
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
OS X PHP Extensions directory (Useful for installing addons) | |
/usr/lib/php/extensions/no-debug-non-zts-20060613 | |
Installing PDO Mysql on OS X | |
1. Download and install MySQL 5.0 Downloads | |
2. cd /usr/local/mysql/lib | |
3. sudo ln -s . mysql | |
4. cd | |
5. Download PDO_MYSQL-1.0.2.tgz | |
6. gunzip PDO_MYSQL-1.0.2.tgz |
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
HTML 5 Position and Coordinates containers | |
interface Position { | |
readonly attribute Coordinates coords; | |
readonly attribute DOMTimeStamp timestamp; | |
}; | |
interface Coordinates { | |
readonly attribute double latitude; | |
readonly attribute double longitude; |
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
// Simple use of CoreLocation | |
// Step 1: Add the CLLocationDelegate to the class header file (and add protocol) | |
// For example | |
#import <CoreLocation/CoreLocation.h> | |
@protocol MyCLControllerDelegate <NSObject> | |
@required | |
-(void)newLocationUpdate:(NSString *)text; | |
-(void)newError:(NSString *)text; |
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 | |
require_once("Mail.php"); | |
$smtp_server="192.168.1.140"; | |
$to = "recipient"; | |
$from = "fromemail"; | |
$msg = "This is a test"; | |
$m = Mail::factory("smtp", array("host" => $smtp_server, "timeout" => "10")); $m->send($to, array("From" => $from), $msg); | |
?> |