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
def determineMatrix (matrix): | |
# here we do some major if statements | |
n1 = 0.0 | |
n2 = 0.0 | |
size = len(matrix) | |
if len(matrix[0]) != size: | |
print "Bad matrix for determination. (" + str(len(matrix)) + "x" + str(len(matrix[0])) + ") " | |
return 0.0 | |
else: | |
print "determining matrix (" + str(len(matrix)) + "x" + str(len(matrix[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
#import <Foundation/Foundation.h> | |
int main (int argc, char * argv[]) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSAppleScript * scrpt = [[NSAppleScript alloc] initWithSource:@"set volume 0\n\ | |
tell application \"System Events\" to set app_name to name of the first process whose frontmost is true\n\ | |
tell application \"Little Snitch UIAgent\" to activate\n\ | |
tell application \"System Events\" to keystroke return\n\ | |
tell application app_name to activate\n\ | |
delay 0.5\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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
int strappend (char ** buff, int alloclen, const char * nstring) { | |
int slen = strlen(buff[0]); | |
int slen2 = strlen(nstring); | |
char * newbuff = (char *)malloc(slen + slen2 + 2); | |
memset(newbuff, 0, slen+slen2+2); |
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 | |
# | |
# Highscore forger for tetris1d | |
# | |
use strict; | |
use IO::Socket; | |
use Socket; | |
my $numArgs = $#ARGV + 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
#!/usr/bin/perl | |
$_ = "the quick brown fox jumps over the lazy dog."; | |
$mstr = "python"; | |
s/( ?)[a-z]+/\1${mstr}/g; | |
$i = length($_); | |
$_ = "the quick brown fox jumps over the lazy dog."; | |
$mstr = "perl"; | |
s/( ?)[a-z]+/\1${mstr}/g; | |
$i1 = length($_); | |
unless ($i1 > $i) { |
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 | |
use strict; | |
sub arrcount { | |
my ($arr) = @_; | |
my $c = 0; | |
foreach my $str (@{$arr}) { | |
++$c; | |
} |
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 | |
use strict; | |
use LWP::UserAgent; | |
sub getmacrumors { | |
my $ua = new LWP::UserAgent; | |
$ua->timeout(120); | |
my $request = new HTTP::Request('GET', 'http://www.macrumors.com/'); | |
my $response = $ua->request($request); |
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 | |
use LWP::UserAgent; | |
use strict; | |
sub getmacrumors { | |
my $ua = new LWP::UserAgent; | |
$ua->timeout(120); | |
my $request = new HTTP::Request('GET', 'http://www.macrumors.com/'); |
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 latestYoutube ($channel) { | |
error_reporting(E_ALL); | |
$feedURL = 'http://gdata.youtube.com/feeds/api/users/' . $channel . '/uploads?max-results=20'; | |
$sxml = simplexml_load_file($feedURL); | |
$i = 0; | |
foreach ($sxml->entry as $entry) { | |
$media = $entry->children('media', true); | |
$url = (string)$media->group->player->attributes()->url; | |
$index = strrpos($url, "&"); | |
$url = substr($url, 0, $index); |
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
// | |
// NSData+hex.h | |
// NSData+hex | |
// | |
// Created by Alex Nichol on 3/29/11. | |
// Copyright 2011 Jitsik. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
OlderNewer