00:00:07 `run printf '%s\n' '#!/bin/sh' "find /var/irclogs/_esoteric -mindepth 1 -maxdepth 1 -type f -name '????-??-??.txt' | sort -r | xargs -d'\n' -r tac -- | grep \"^..:..:..: <"'$1'">\" | head -n 1" >bin/seen; chmod 755 bin/seen; cat bin/seen 00:00:10 ​#!/bin/sh \ find /var/irclogs/_esoteric -mindepth 1 -maxdepth 1 -type f -name '????-??-??.txt' | sort -r | xargs -d'\n' -r tac -- | grep "^..:..:..: <$1>" | head -n 1 00:00:15 `seen elliott 00:00:18 23:54:46: oerjan: ok you make it search in reverse order then \ xargs: tac: terminated by signal 13 00:00:28 hm we definitely want it to be case insensitive 00:00:52 HackEgo: how tacky 00:01:35 Someone else figure the SIGPIPE thing out. :-P 00:01:49 `cat bin/log 00:01:49 ​#!/bin/sh \ cd /var/irclogs/_esoteric \ if [ "$1" ]; then \ grep -P -i -- "$1" ????-??-??.txt | shuf -n 1 \ else \ file=$(shuf -en 1 ????-??-??.txt) \ echo "$file:$(shuf -n 1 $file)" \ fi 00:02:01 `run sed -is 's/grep/grep -P -i/' bin/seen 00:02:04 No output. 00:02:09 `cat bin/seen 00:02:10 ​#!/bin/sh \ find /var/irclogs/_esoteric -mindepth 1 -maxdepth 1 -type f -name '????-??-??.txt' | sort -r | xargs -d'\n' -r tac -- | grep -P -i "^..:..:..: <$1>" | head -n 1 00:02:52 ion: that is probably not really any faster btw 00:02:56 since it has to list all the kajillion files 00:03:05 which takes a noticeable amount of time locally 00:03:25 `run time find /var/irclogs/_esoteric -mindepth 1 -maxdepth 1 -type f -name '????-??-??.txt' | sort -r >/dev/null 00:03:27 ​ \ real0m1.196s \ user0m0.560s \ sys0m1.080s 00:04:02 `run time sh -c 'find /var/irclogs/_esoteric -mindepth 1 -maxdepth 1 -type f -name '????-??-??.txt' | sort -r >/dev/null' 00:04:04 ​ \ real0m0.930s \ user0m0.620s \ sys0m0.650s 00:04:33 '''' error, but i think time might not work here. 00:04:35 `run time true 00:04:36 ​ \ real0m0.001s \ user0m0.000s \ sys0m0.000s 00:04:44 `run bash -c 'time true' 00:04:45 ​ \ real0m0.001s \ user0m0.000s \ sys0m0.000s 00:04:50 `run sh -c 'time true' 00:04:51 sh: time: not found 00:04:55 `run cd /var/irclogs/_esoteric; ls ????-??-??.txt 00:04:57 2003-01-18.txt \ 2003-01-19.txt \ 2003-01-20.txt \ 2003-01-21.txt \ 2003-01-22.txt \ 2003-01-23.txt \ 2003-01-24.txt \ 2003-01-25.txt \ 2003-01-26.txt \ 2003-01-27.txt \ 2003-01-28.txt \ 2003-01-29.txt \ 2003-01-30.txt \ 2003-01-31.txt \ 2003-02-01.txt \ 2003-02-02.txt \ 2003-02-03.txt \ 2003-02-04.txt \ 2003-02-05.txt \ 2003-02-06.txt \ 2003-02-07 00:05:12 `run cd /var/irclogs/_esoteric; ls ????-??-??.txt | tac 00:05:14 2013-01-22.txt \ 2013-01-21.txt \ 2013-01-20.txt \ 2013-01-19.txt \ 2013-01-18.txt \ 2013-01-17.txt \ 2013-01-16.txt \ 2013-01-15.txt \ 2013-01-14.txt \ 2013-01-13.txt \ 2013-01-12.txt \ 2013-01-11.txt \ 2013-01-10.txt \ 2013-01-09.txt \ 2013-01-08.txt \ 2013-01-07.txt \ 2013-01-06.txt \ 2013-01-05.txt \ 2013-01-04.txt \ 2013-01-03.txt \ 2013-01-02 00:05:33 you can make ls sort reversed 00:05:39 oh 00:06:08 `run cd /var/irclogs/_esoteric; ls -r 00:06:09 stalker.php \ latest.txt \ index.php \ 2013-01-22.txt \ 2013-01-22-raw.txt \ 2013-01-21.txt \ 2013-01-21-raw.txt \ 2013-01-20.txt \ 2013-01-20-raw.txt \ 2013-01-19.txt \ 2013-01-19-raw.txt \ 2013-01-18.txt \ 2013-01-18-raw.txt \ 2013-01-17.txt \ 2013-01-17-raw.txt \ 2013-01-16.txt \ 2013-01-16-raw.txt \ 2013-01-15.txt \ 2013-01-15-raw.txt \ 2013-01 00:06:19 stalker.php? 00:06:21 `run cd /var/irclogs/_esoteric; ls -r | grep '????-??-??\.txt' 00:06:23 No output. 00:06:30 ion: probably what runs stalker mode? 00:06:34 `run cd /var/irclogs/_esoteric; ls -r | grep '....-..-..\.txt' | head -n 1 00:06:36 2013-01-22.txt 00:07:39 `run echo "#!/bin/sh" >bin/seen; echo 'cd /var/irclogs/_esoteric' >>bin/seen; echo 'for file in $(ls -r | grep "....-..-..\.txt"); do grep -P -i "^..:..:..: <$1>" $file; done | tail -n 1' >>bin/seen; chmod +x bin/seen 00:07:42 `run cd /var/irclogs/_esoteric; ls -r ????-??-??.txt 00:07:43 No output. 00:07:44 2013-01-22.txt \ 2013-01-21.txt \ 2013-01-20.txt \ 2013-01-19.txt \ 2013-01-18.txt \ 2013-01-17.txt \ 2013-01-16.txt \ 2013-01-15.txt \ 2013-01-14.txt \ 2013-01-13.txt \ 2013-01-12.txt \ 2013-01-11.txt \ 2013-01-10.txt \ 2013-01-09.txt \ 2013-01-08.txt \ 2013-01-07.txt \ 2013-01-06.txt \ 2013-01-05.txt \ 2013-01-04.txt \ 2013-01-03.txt \ 2013-01-02 00:07:45 `seen elliott 00:07:53 oerjan: that does the ls in the shell, though 00:07:57 so you're not saving anything 00:08:05 er 00:08:10 `run echo "#!/bin/sh" >bin/seen; echo 'cd /var/irclogs/_esoteric' >>bin/seen; echo 'for file in $(ls -r | grep "....-..-..\.txt"); do grep -P -i "^..:..:..: <$1>" $file; done | head -n 1' >>bin/seen; chmod +x bin/seen 00:08:27 hm... 00:08:48 No output. 00:08:49 No output. 00:09:06 `seen bike 00:09:37 00:06:30: ion: probably what runs stalker mode? 00:09:44 `seen elliott 00:09:46 ouch 00:09:52 why is this slower. 00:09:58 oh hm 00:10:15 00:01:49: `cat bin/log 00:10:29 what. 00:10:34 gee 00:10:46 presumably for `seen me it ought to return `seen me 00:10:47 elliott: you're not doing each file backwards 00:10:54 `run echo "#!/bin/sh" >bin/seen; echo 'cd /var/irclogs/_esoteric' >>bin/seen; echo 'ls -r | grep "....-..-..\.txt" | while read file; do grep -P -i "^..:..:..: <$1>" $file | tail -n 1; done | head -n 1' >>bin/seen; chmod +x bin/seen 00:10:55 oooooh 00:10:58 No output. 00:10:58 oerjan: right. 00:11:01 `seen elliott 00:11:17 well this isn't very good 00:11:27 grep -P is apparently PCRE mode, i'm lost 00:11:31 00:11:01: `seen elliott 00:11:40 "success!" 00:11:48 i can write regex but i can never seem to use regex grep 00:11:53 what is going on here ? 00:11:53 it's kind of annoying 00:11:59 c00kiemon5ter: "engineering" 00:12:40 does anyone wnat to optimise this code 00:13:03 -!- epicmonkey has quit (Ping timeout: 245 seconds). 00:13:55 `run sed -i 's/-P/-H -P/' bin/seen 00:13:58 No output. 00:14:03 `seen elliott 00:14:16 "perl" "compatible" "regular" expressions 00:14:19 speaking of "engineering", any of you play spacechem? 00:14:25 kmc: not very expressive either 00:14:28 that's quite awful... 00:14:34 2013-01-22.txt:00:12:40: does anyone wnat to optimise this code 00:14:36 i feel likei should complain about grep's regex implementation too 00:14:38 "oh well" 00:14:38 oerjan: I like how the original version was by far the fastest 00:14:46 Bike: please go ahead 00:14:56 no we already covered that, pike bla bla bla 00:15:05 bla 00:15:26 pike? 00:15:31 is there a good way to profile shell scripts 00:15:46 I hope not 00:15:46 olsner: rob, rc2 and shit 00:15:59 ah, not pike the programming language then 00:16:10 or whatever that implementation is called 00:16:56 -!- augur has joined. 00:17:08 (http://pike.lysator.liu.se/) 00:18:14 http://swtch.com/~rsc/regexp/regexp1.html this maybe? 00:18:28 well that's the paper 00:18:49 but last time it was mentioned somebody (probably elliott, why must you mock me) mentioned a regex implementation based on it 00:18:55 google's RE2? 00:18:59 yeah that one. 00:19:06 yeah it's pretty good 00:19:10 i wrote incomplete Haskell bindings 00:19:18 a friend used RE2 to make http://livegrep.com 00:27:42 `run ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do grep -i "^..:..:..: " "$file" | tail -n 1; done | head -n 1 00:28:13 00:27:42: `run ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do grep -i "^..:..:..: " "$file" | tail -n 1; done | head -n 1 00:37:32 I can imagine some ways to write really horrific Smalltalk code 00:37:44 smalltalk golf 00:37:50 you could enter it into my devious code contest 00:37:52 if i ever run that 00:38:00 you can write bytecode, ,put it in a byte array, and evaluate it 00:38:17 that's not devious, that's obvious 00:38:18 There are objects that respond to value to mean something other than execution or cached or whatever: 00:38:21 calling out to assembly is so boring though! 00:38:28 i did that in haskell once 00:38:41 with native machine code 00:38:43 now, if you could treat an object as a byte array and evaluate it 00:38:47 then we're talkin 00:38:54 (2 > 1) ifTrue: 'a' -> 'b' ifFalse: 'b' -> 'a' 00:39:15 Bike at the metaprogramming level, you can do lots of oddities. 00:39:16 The result of that is 'b' 00:39:17 what's -> do 00:39:24 Makes an association 00:39:34 its the association operator 00:39:35 'a' -> 'b' is an Association with key 'a' and value 'b' 00:39:41 oh 00:39:48 so why doesn't it return however you notate {a,b} 00:39:49 is it just a tuple 00:39:52 a := 'a' -> 'b'. creates an association 00:40:05 sounds like a tuple 00:40:07 if it's just an operator precedence thing than that's also boring 00:40:15 it is an object of class Association 00:40:18 elliott, well, it's Smalltalk, don't expect plain tuples 00:40:31 sounds like a plain tuple with the name Association 00:40:31 In particular, its parts are accessed with key and ... value 00:40:32 why couldn't you have plain tuples in smalltalk 00:40:42 Bike everythign is an object 00:40:45 right 00:40:54 so you have a Tuple object that responds to member0: or w/e 00:41:05 -!- oerjan has quit (Quit: Good night). 00:41:07 or well how you already do arrays probably 00:41:08 There are arrays 00:41:08 so you COULD create a method #asTuple for association 00:41:21 {'a'. 'b'} at: 1 00:41:22 Is 'a' 00:41:38 But it's nice to store and document the meaning of the container 00:41:41 anyway, explain your "deviousness", sgeo. 00:41:48 Bike: are you as bored as me 00:41:59 yes, yes i am. 00:42:00 'a' -> 'b' is an object, that responds to the value message 00:42:09 smalltalk is way more interesting than... some tv show i'm not really paying attention to 00:42:21 ifTrue:ifFalse: sends value to whichever argument is the correct one 00:42:28 saijanai_: metaprogramming reminds me, what kind of messages do blocks respond to? 00:42:33 Normally, the value message is sent to a block to execute it 00:42:54 But in this case, the value message is being sent to an Association 00:42:59 Bike: what's the tv show 00:43:04 #value, #value:, #value:value: etc 00:43:25 elliott: something about squids that doesn't have nearly enough biology 00:43:48 crocasquiduana? 00:43:58 Bike: biology just gets in the way of squids really 00:44:05 -!- copumpkin has quit (Ping timeout: 248 seconds). 00:44:08 a new scyfy horror movie 00:44:25 nope squid biology is awesome sorry 00:44:37 i would watch a textbook on cephalopodology in tv show form 00:44:41 -!- copumpkin has joined. 00:45:02 ok but only if it's not a documentary 00:45:08 romantic comedy series about squid biology 00:45:09 pitch it to the History or Discovery channels but you need to have aliens 00:45:14 yeah, that'd be good. 00:45:15 | assoc | 00:45:15 assoc := Association new. 00:45:15 assoc ifNotNilDo: assoc. 00:45:33 what, smalltalk has nil? 00:45:33 What does assoc look like now? 00:45:54 nil is one of the 6 predefined words of Smalltalk 00:46:22 what's it for? doesn't really seem like a language that needs a null pointer 00:46:25 `run ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do awk -vs="^..:..:..: " '$0 ~ s{x=$0} END{if(!x) exit 1; print x}' "$file" && break; done 00:46:27 00:46:25: `run ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do awk -vs="^..:..:..: " '$0 ~ s{x=$0} END{if(!x) exit 1; print x}' "$file" && break; done 00:46:45 I'd blame this on the use of the same selector (method name) to mean different things to different classes 00:46:52 its the recipient of #ifTrue: 00:47:09 oh, so just the false value? 00:47:14 Where with generic methods, each method presumably has one intended meaning, with this style of OO, the same method name can be used to mean utterly different things in different contexts 00:47:22 excuxe, the #ifNil: message 00:47:24 Bike, false is the false value 00:47:31 so... what's nil for 00:47:39 nil value 00:47:40 it is the default object type for any undefined variable name 00:47:55 blurgh. 00:47:55 so you automatically catch undefined variables 00:47:58 `run printf '%s\n' '#!/bin/sh' 'ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do awk -vs="^..:..:..: <$1>" '$0 ~ s{x=$0} END{if(!x) exit 1; print x}' "$file" && break; done' >bin/seen 00:47:59 bash: -c: line 0: syntax error near unexpected token `(' \ bash: -c: line 0: `printf '%s\n' '#!/bin/sh' 'ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do awk -vs="^..:..:..: <$1>" '$0 ~ s{x=$0} END{if(!x) exit 1; print x}' "$file" && break; done' >bin/seen' 00:48:18 <.< 00:48:43 `run echo '#!/bin/sh' >bin/seen; echo 'ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do awk -vs="^..:..:..: <$1>" '$0 ~ s{x=$0} END{if(!x) exit 1; print x}' "$file" && break; done' >>bin/seen 00:48:44 bash: -c: line 0: syntax error near unexpected token `(' \ bash: -c: line 0: `echo '#!/bin/sh' >bin/seen; echo 'ls -r /var/irclogs/_esoteric/????-??-??.txt | while read -r file; do awk -vs="^..:..:..: <$1>" '$0 ~ s{x=$0} END{if(!x) exit 1; print x}' "$file" && break; done' >>bin/seen' 00:48:52 I think this is an argument for having first class methods 00:49:01 Something more like CLOS than like Smalltalk 00:49:09 ah :P 00:49:33 sgeo I'm not familiar with how CLOS does things 00:49:37 i think i asked this before, but, i thought you didn't have to have a notion of methods, just objects responding however they want to messages. which would be methods in most situations but not necessarily. 00:50:09 I'm not sure what CLOS has to do with anything. 00:50:22 saijanai_, you create generic functions, and then can separately define implementations if, say, argument 1 is some class or a subclass 00:50:33 a message in smalltalk is a bunch of variables on the stack followed by the method name 00:50:47 Bike, just noting a different between CLOS and Smalltalk 00:50:50 Besides the obvious 00:50:59 "a difference"? they're totally different 00:51:33 `run curl -s http://sprunge.us/bCUe >bin/seen 00:51:38 No output. 00:51:48 `cat bin/seen 00:51:49 cat: bin/seen : No such file or directory 00:51:51 Sgeo I imagine StrongTalk allows something like that, but StrongTalk never became real popular, even by Smalltalk standards 00:52:47 `ls bin 00:52:48 ​? \ @ \ WELCOME \ addquote \ allquotes \ anonlog \ botsnack \ calc \ define \ delquote \ emoclew \ etymology \ forget \ fortune \ frink \ google \ hatesgeo \ interp \ joustreport \ jousturl \ json \ karma \ karma- \ karma+ \ learn \ list \ lists \ log \ logurl \ lua \ luac \ luarocks \ luarocks-admin \ macro \ makelist \ maketext \ 00:52:49 -!- augur_ has joined. 00:52:51 -!- augur has quit (Ping timeout: 244 seconds). 00:53:23 `ls bin | tac 00:53:24 ls: cannot access bin | tac: No such file or directory 00:53:25 I thought strongtalk was a smalltalk with strong typing? CLOS isn't really an efficiency thing, it's just a way of object-system-ing that's different from smalltalk 00:53:42 Bike, here's what I'm getting at. 00:53:53 `run ls bin | tac 00:53:54 zalgoerjan \ zalgo \ wtf \ words \ word \ wl \ WELCOME \ WeLcOmE \ welcome \ url \ units \ translatetoerjan \ translateto \ translatefromto \ translate \ toutf8 \ tell \ tclkit \ show \ seens \ seen \ searchlog \ runce \ runc \ run \ rot13 \ roll \ rng \ relcome \ randomanonlog \ quotes \ quote \ quørjan \ quoerjan \ quachaf \ qc \ prefixes \ ping 00:53:59 With CLOS, each generic function is a concrete value, a thing, that's intended to have one sort of functionality. 00:54:10 sure. 00:54:10 `run cat bin/seen 00:54:11 ERROR: The requested URL could not be retrieved