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
-(NSDictionary *)readDatafile:(NSString *)plistfile {
NSLog(@"Reading PLIST file %@", plistfile);
return [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:plistfile ofType:@"plist"]];
}
def countwordsInString(string, delimiter, word):
occurs = 0
stringarray = string.split(delimiter)
for stringword in stringarray:
if word == stringword:
occurs = occurs + 1
return occurs
@nolim1t
nolim1t / gist:121282
Created June 1, 2009 07:15
Count the number of occurances in a string
<?php
function countwordsInString($string, $delimiter, $word) {
$occurs = 0;
foreach (explode($delimiter, $string) as $stringword) if ($word == $stringword) $occurs++;
return $occurs;
}
?>
@nolim1t
nolim1t / gist:121949
Created June 2, 2009 02:43
Show all txt files in the Downloads directory
<?php
foreach (scandir("Downloads") as $f) if ((substr($f, -3, 3) == "txt" || substr($f, -3, 3) == "csv") && stristr(strtolower($f), "errors")) echo $f."\n";
?>
@nolim1t
nolim1t / gist:122068
Created June 2, 2009 05:12
Strip out windows linebreaks
perl -pi -e "s/\r\n/\n/" $1
<?php
$memcache = new Memcache;
$memcache->connect('a.b.c.d', 11211);
$memcache->set('test', 'This could be an array or an object (the methods wont get saved!', false, 600);
$retrieval = $memcache->get('test');
if ($retrieval) print_r($retrieval);
?>
@nolim1t
nolim1t / gist:122904
Created June 3, 2009 09:37
VBScript code to show when a file was last modified
Set fso = CreateObject(Scripting.FileSystemObject)
Set f = fso.GetFile("Path\to\file")
MsgBox CLng(DateDiff("s", f.DateLastModified, Now))
<?php
foreach ($cmds as $cmd) {
$pid=pcntl_fork();
if ($pid) {
exec($cmd);
break;
}
}
?>
@nolim1t
nolim1t / gist:126220
Created June 9, 2009 02:56
Bonus points if you work out what this Perl does!
for($a=1;$a<=11;$a++){if($a==1){print "h";}elsif($a==2){print "e";}elsif($a==3 or $a==4 or $a==10){print "l";}elsif($a==5 or $a==8){print "o";}elsif($a==11){print "d";}elsif($a==7){print "w";}elsif($a==9){print "r";}else{print " ";}}
@nolim1t
nolim1t / gist:126455
Created June 9, 2009 12:34
Quality Center OTA via PHP
<?php
// Found this on the web
// Requirements: PHP + COM + Win32 (duh)
// DISCLAIMER: Found this on the web. Have not tested this yet, but it would come in handy
$qcurl =$_GET["qcurl"];
$usr =$_GET["usr"];
$pwd =$_GET["pwd"];
$dmn =$_GET["dmn"];