Skip to content

Instantly share code, notes, and snippets.

View nolim1t's full-sized avatar
💭
Destablizing Authoritarian governments to ₿UIDL ₿ack ₿etter

nolim1t - f6287b82CC84bcbd nolim1t

💭
Destablizing Authoritarian governments to ₿UIDL ₿ack ₿etter
View GitHub Profile
@nolim1t
nolim1t / gist:126982
Created June 10, 2009 02:53
Formatting the date (show the local system time)
#!/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]));
@nolim1t
nolim1t / socket.c
Created June 10, 2009 03:14
HTTP Request in C using low level write to socket functionality
#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>
@nolim1t
nolim1t / gist:127656
Created June 11, 2009 02:20
Compare 2 files
#!/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
@nolim1t
nolim1t / gist:130080
Created June 15, 2009 12:45
Curl Scripting :D
#!/bin/bash
curl -F "upload=@/path/to/file" -F "press=OK" URL
@nolim1t
nolim1t / gist:130473
Created June 16, 2009 01:41
Bash HELPER script to genererate phpdoc
!/bin/bash
FROM=$1
TO=/Users/user/Documents/phpdoc/$2
if [ $# == 2 ];
then
echo "Generating..."
phpdoc -d $FROM -t $TO
else
@nolim1t
nolim1t / gist:133742
Created June 22, 2009 01:03
Simple PHP HTTP Request code which uses the curl PHP bindings
<?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);
@nolim1t
nolim1t / gist:134353
Created June 23, 2009 04:21
Adding new PHP extensions to Mac OS X as well as building pdo_mysql
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
@nolim1t
nolim1t / gist:134430
Created June 23, 2009 08:25
HTML5 Geolocation code!!
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;
@nolim1t
nolim1t / gist:138126
Created June 30, 2009 12:17
Very rought coding with some comments on how to use CoreLocation)
// 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;
<?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);
?>