Guess the snippet
1
Name:
Anonymous
2010-05-22 9:26
I'll start
(defconst *path-delimiter* ">")
(defconst *type-delimiter* ".")
(defconst *version-delimiter* ".")
(defconst *directory-entry-file-type-max-length* 14.)
(defconst *lmfs-name-of-the-root* "The Root Directory")
(defflavor lmfs-mailbox-pathname-mixin () (mailbox-pathname-mixin)
(:abstract-flavor)
(:documentation :mixin "for ZMAIL's methods"))
(defflavor lmfs-pathname-mixin
()
(lmfs-mailbox-pathname-mixin
no-device-mixin
hierarchical-directory-mixin
meaningful-root-mixin
both-cases-same-lower-preferred-mixin)
(:required-flavors pathname)
(:functions lmfs-pathname-fname-string)) ;This one is forward-referenced
2
Name:
Anonymous
2010-05-22 9:34
Lisp Machine flavors implementation of email?
3
Name:
Anonymous
2010-05-22 9:40
fibs?
4
Name:
Anonymous
2010-05-22 9:42
Zetalisp and Flavors -> OpenGenera?
5
Name:
Anonymous
2010-05-22 10:09
>>4
OpenGenera/Genera is written in Zetalisp and Flavors.
>>1
I kind of cheated, but it's part of
lmfs\lmfs-pathnames.lisp
That's one of two scripts used to setup the Lispm filsystem in (Open)Genera.
6
Name:
Anonymous
2010-05-22 10:37
Right, someone else have another snippet?
7
Name:
Anonymous
2010-05-22 11:14
Ok, heres one
(define (check:proc-ec w)
(let ((correct? (car w))
(expression (cadr w))
(actual-result (caddr w))
(expected-result (cadddr w))
(cases (car (cddddr w)))
(equal-expr (cadr (cddddr w))))
(if correct?
(begin (if (>= check:mode 100)
(begin (check:report-expression expression equal-expr)
(check:report-actual-result actual-result)
(check:report-correct cases)))
(check:add-correct!))
(begin (if (>= check:mode 10)
(begin (check:report-expression expression equal-expr)
(check:report-actual-result actual-result)
(check:report-failed expected-result)))
(check:add-failed!
expression actual-result expected-result equal-expr)))))
8
Name:
Anonymous
2010-05-22 11:22
9
Name:
Anonymous
2010-05-22 11:26
>>8
I'm assuming you googled it :)
10
Name:
Anonymous
2010-05-22 11:31
11
Name:
Anonymous
2010-05-22 13:45
12
Name:
Anonymous
2010-05-22 13:53
>>11
you and your hacker smileys
13
Name:
Anonymous
2010-05-22 13:57
Next one
TerminalShell.commands['apt-get'] = function(terminal, subcmd) {
if (!this.sudo && (subcmd in {'update':true, 'upgrade':true, 'dist-upgrade':true})) {
terminal.print('E: Unable to lock the administration directory, are you root?');
} else {
if (subcmd == 'update') {
terminal.print('Reading package lists... Done');
} else if (subcmd == 'upgrade') {
if (($.browser.name == 'msie') || ($.browser.name == 'firefox' && $.browser.versionX < 3)) {
terminal.print($('<p>').append($('<a>').attr('href', 'http://abetterbrowser.org/ ').text('To complete installation, click here.')));
} else {
terminal.print('This looks pretty good to me.');
}
} else if (subcmd == 'dist-upgrade') {
var longNames = {'win':'Windows', 'mac':'OS X', 'linux':'Linux'};
var name = $.os.name;
if (name in longNames) {
name = longNames[name];
} else {
name = 'something fancy';
}
terminal.print('You are already running '+name+'.');
} else if (subcmd == 'moo') {
terminal.print(' (__)');
terminal.print(' (oo)');
terminal.print(' /------\\/ ');
terminal.print(' / | || ');
terminal.print('* /\\---/\\ ');
terminal.print(' ~~ ~~ ');
terminal.print('...."Have you mooed today?"...');
} else if (!subcmd) {
terminal.print('This APT has Super Cow Powers.');
} else {
terminal.print('E: Invalid operation '+subcmd);
}
}
};
14
Name:
Anonymous
2010-05-22 14:04
>>13
UBANTO O
And by that I mean
xkcd fagort terminal .
15
Name:
Anonymous
2010-05-22 14:39
void
load_uri_imp(gchar *uri) {
GString* newuri;
if (g_strstr_len (uri, 11, "javascript:") != NULL) {
eval_js(uzbl.gui.web_view, uri, NULL);
return;
}
newuri = g_string_new (uri);
if (!soup_uri_new(uri)) {
GString* fullpath = g_string_new ("");
if (g_path_is_absolute (newuri->str))
g_string_assign (fullpath, newuri->str);
else {
gchar* wd;
wd = g_get_current_dir ();
g_string_assign (fullpath, g_build_filename (wd, newuri->str, NULL));
free(wd);
}
struct stat stat_result;
if (! g_stat(fullpath->str, &stat_result)) {
g_string_prepend (fullpath, "file://");
g_string_assign (newuri, fullpath->str);
}
else
g_string_prepend (newuri, "http://");
g_string_free (fullpath, TRUE);
}
/* if we do handle cookies, ask our handler for them */
webkit_web_view_load_uri (uzbl.gui.web_view, newuri->str);
g_string_free (newuri, TRUE);
}
16
Name:
Anonymous
2010-05-22 15:24
GString
I giggled.
17
Name:
Anonymous
2010-05-22 16:57
>>15
Optionally handles cookies
WebKit
UZBL. amirite?
18
Name:
Anonymous
2010-05-22 17:05
19
Name:
Anonymous
2010-05-22 17:40
interactive("universal-digit",
"Part of the numeric argument for the next command.",
function (I) {
var digit = I.event.charCode - 48;
if (I.prefix_argument == null)
I.prefix_argument = digit;
else if (typeof I.prefix_argument == "object") { // array
if (I.prefix_argument[0] < 0)
I.prefix_argument = -digit;
else
I.prefix_argument = digit;
}
else if (I.prefix_argument < 0)
I.prefix_argument = I.prefix_argument * 10 - digit;
else
I.prefix_argument = I.prefix_argument * 10 + digit;
},
$prefix = true);
20
Name:
another one
2010-05-22 17:42
if ($_SERVER[REQUEST_METHOD] != 'GET') fancydie('I POSTed your mom in the ass last night.');
// settings file
$glob = file("globalsettings.txt") or fancydie("Eh? Couldn't fetch the global settings file?!");
foreach ($glob as $tmp){ $tmp = trim($tmp); list ($name, $value) = explode("=", $tmp); $setting[$name] = $value; }
if($_SERVER[PATH_INFO]){
$pairs = explode('/',$_SERVER[PATH_INFO]);
$bbs = $pairs[1];
$local = @file("$bbs/localsettings.txt");
if ($local) { foreach ($local as $tmp){ $tmp = trim($tmp); list ($name, $value) = explode("=", $tmp); $setting[$name] = $value; } }
$key = $pairs[2];
if (!$pairs[3]) {$posts = array("1-"); $st = 1; $to = $setting[postsperpage]; }
else {
$posts = explode(',',$pairs[3]);
}
21
Name:
Anonymous
2010-05-22 17:50
22
Name:
Anonymous
2010-05-22 17:50
>>19
It sounds like it should be a part of emacs, but looks kinda like Java or javascript. Is there an emacs plugin for eclipse ?
23
Name:
Anonymous
2010-05-22 17:56
>>22
on second thoughts it can't be eclipse, since thats more like javascript than Java.
24
Name:
Anonymous
2010-05-22 17:57
PHP is beautiful and so are its users
<?
set_time_limit(0);
echo "
<br>";
$digits=1000;
$pival='1';
$str1='';
while ($pirow<2000)
{
$pirow+=1;
$pisubrow=0;
$tempval='0';
while ($pisubrow<$pirow)
{
$tempval=bcsqrt(bcadd('2',$tempval,$digits),$digits);
$pisubrow+=1;
sleep(1);
}
$tempval=bcdiv('2',$tempval,$digits);
$pival=bcmul($tempval,$pival,$digits);
unset($tempval);
$tempval=bcmul('2',$pival,$digits);
$common = array();
$length = (strlen($str1) >= strlen($tempval)) ? strlen($str1) : strlen($tempval);
for($x=0;$x<$length;$x++){
if($str1[$x] == $tempval[$x]){
$common[] = $str1[$x];
}else{
break;
}
}
if ($pirow>5)
{
echo "pi=".substr(join('',$common),0,-2);
}
unset($str1);
$str1=$tempval;
unset($tempval);
echo "<p>";
flush();
sleep(1);
}
$pival=bcmul($pival,'2',$digits);
unset($pirow);
?>
25
Name:
>>22
2010-05-22 18:21
>>19
There is something very similar to this in the Ymacs source code, but i've been looking through the revisions and it doesn't appear to be that :( I'm sure it's an emacs written in Javascript though
26
Name:
>>25
2010-05-22 18:37
27
Name:
Anonymous
2010-05-22 19:26
;niggers
28
Name:
Anonymous
2010-05-22 19:27
#niggers niggers #niggers #niggers
29
Name:
Anonymous
2010-05-30 8:26
L0
[0] (leaq (@ (:^ L0) (% rip)) (% fn))
[7] (cmpl ($ 16) (% nargs))
[10] (jne L77)
[12] (pushq (% rbp))
[13] (movq (% rsp) (% rbp))
[16] (pushq (% arg_y))
[17] (pushq (% arg_z))
[18] (movq (@ -8 (% rbp)) (% arg_y))
[22] (movq (@ -16 (% rbp)) (% arg_z))
[26] (subq ($ 13) (@ 216 (% save3)))
[34] (movq (@ 216 (% save3)) (% temp0))
[41] (cmpq (@ 224 (% save3)) (% temp0))
[48] (ja L52)
[50] (uuo-alloc)
L52
[52] (andb ($ 240) (@ 216 (% save3)))
[60] (movq (% arg_y) (@ 5 (% temp0)))
[64] (movq (% arg_z) (@ -3 (% temp0)))
[68] (movq (% temp0) (% arg_z))
[71] (leaveq)
[72] (retq)
L77
[77] (uuo-error-wrong-number-of-args)
This was created with disassemble, if you already didn't know that. This is a pretty canonic function so it shouldn't be that much of an issue.
Extra points for guessing the implementation.
30
Name:
Anonymous
2010-05-30 9:33
# round to one decimal place and
# separate into whole and fractional parts
parts = str(round(star_sum/num_raters, 1)).split('.')
whole = int(parts[0])
frac = int(parts[1])
if frac < 3:
___frac = 0
elif frac > 7:
___frac = 0
___whole += 1
else:
___frac = 5
# recombine for a star rating rounded to the half
stars = float(str(whole)+’.'+str(frac))
31
Name:
Anonymous
2010-05-30 9:46
>>29
Looks like ClozureCL's
disassemble .
It's a 4 argument function, altough I'm really not used to its strange disassembly format. I'd probably understand raw x86 better. I don't know what exactly the function is supposed to do, as I'm not used to CCL's x86 assembly macro language.
32
Name:
>>31
2010-05-30 9:47
Looking closer, I think it might be CONS , but I'm still unsure.
33
Name:
>>31
2010-05-30 9:51
(Obviously, I guessed the argument count incorrectly as I didn't take into consideration that the arch was x86_64, not x86)
34
Name:
Anonymous
2010-05-30 9:53
>>31
Correct! How the fuck...?
Goddamn you make me proud to be a progrider.
35
Name:
Anonymous
2010-05-30 11:29
>>30
Leah Culver EXPERT rounding algorithm.
36
Name:
Anonymous
2010-05-30 12:59
: check-password
password .addr @ if
0 autoboot
false >r
begin
bell emit bell emit
." Password: "
password .len @ read-password
dup password .len @ = if
2dup password .addr @ password .len @
compare 0= if r> drop true >r then
then
drop free drop
r@
until
r> drop
then
;
37
Name:
Anonymous
2010-05-30 13:30
>>36
Recognized it that it was some forth code for authing something, probably part of a bootloader. Google confirms that it's a FreeBSD bootloader.
http://fxr.watson.org/fxr/source/boot/forth/loader.4th?v=FREEBSD54
Newer Posts