Re: [dev] Sandy editor
+ John Matthewman ---+ > > I also have two wishes: > > - Make it possible to turn off highlighting (syntax highlighting, > highlighting the current line) and colour. I'm sure I'm not the only > person who doesn't need that stuff..? > - Keep it as a modeless editor! ;) > > John > i really like your wishes !
Re: [dev] Sandy editor
On Fri, May 27, 2011 at 4:52 AM, John Matthewman wrote: > Yea, probably a good idea (of course, ignoring Emacs' chained > keybindings). Sandy would benefit from a better set of default > bindings. Though for reference you might want to look at something > like mg [http://www.openbsd.org/cgi-bin/man.cgi?query=mg], or one of > the other micro Emacs implementations, as they'll have the most > important bindings and commands, and you won't have to sift through > all of the extra garbage that is Emacs. *Please*, use sane keybindings. Emacs and vi were made with a specific keyboard from the 70s in mind. A time were the hjkl keys had little arrows on them. A triangle layout (wqsd or ijkl for example) is much easier to type. Highly recommended readings from the (in?)famous Xah Lee: http://xahlee.org/emacs/keyboard_hardware_and_key_choices.html http://xahlee.org/kbd/vi_emacs_keybinding_design.html http://xahlee.org/comp/keyboard_shortcut_design.html Keyboard related (prepare for some time warp if you start reading): http://xahlee.org/Periodic_dosage_dir/keyboarding.html
Re: [dev] Sandy editor
On Fri, May 27, 2011 at 10:29 AM, Aurélien Aptel wrote: > arrows on them. A triangle layout (wqsd or ijkl for example) is much > easier to type. I meant wasd (on qwerty), obviously.
Re: [dev] Sandy editor
On Fri, 27 May 2011 10:29:17 +0200 Aurélien Aptel wrote: > On Fri, May 27, 2011 at 4:52 AM, John Matthewman > wrote: > > Yea, probably a good idea (of course, ignoring Emacs' chained > > keybindings). Sandy would benefit from a better set of default > > bindings. Though for reference you might want to look at something > > like mg [http://www.openbsd.org/cgi-bin/man.cgi?query=mg], or one of > > the other micro Emacs implementations, as they'll have the most > > important bindings and commands, and you won't have to sift through > > all of the extra garbage that is Emacs. > > *Please*, use sane keybindings. Emacs and vi were made with a specific > keyboard from the 70s in mind. A time were the hjkl keys had little > arrows on them. A triangle layout (wqsd or ijkl for example) is much > easier to type. > > Highly recommended readings from the (in?)famous Xah Lee: > http://xahlee.org/emacs/keyboard_hardware_and_key_choices.html > http://xahlee.org/kbd/vi_emacs_keybinding_design.html > http://xahlee.org/comp/keyboard_shortcut_design.html > > Keyboard related (prepare for some time warp if you start reading): > http://xahlee.org/Periodic_dosage_dir/keyboarding.html > how ironic you pledge for "sane" keybindings and suggest bindings optimized for qwerty users... I use dvorak, so I would prefer bindings optimized for that, but I realise different people use different layouts, so everyone should be able to choose how they like it. Dieter
Re: [dev] Sandy editor
On Fri, May 27, 2011 at 10:54 AM, Dieter Plaetinck wrote: > how ironic you pledge for "sane" keybindings and suggest > bindings optimized for qwerty users... I've used qwerty bindings for the example so anyone could follow. I don't use qwerty myself.
Re: Playing music (was: Re: [dev] mret)
On Thu, May 26, 2011 at 2:22 PM, hiro <23h...@googlemail.com> wrote: > Hmm. How do you "buffer linewise"? I'm 99% sure that means the songs file is a line-delimited list of filenames. --Andrew Hills
Re: Playing music (was: Re: [dev] mret)
I still don't get the whole idea. http://sqweek.dnsdojo.org/code/m9u/
Re: [dev] Sandy editor
On Thu, May 26, 2011 at 3:53 PM, Rafa Garcia Gallego wrote: > That is indeed a great idea. I'll try to stick with the UNIX defaults, > fill in with Emacs when in doubt and remove META when possible. Please, please, please do not use Emacs-style "chains". They make no sense and hurt the hands. > Real sorry for the Meta-Shift-q. I changed (as most people? that's > what I thought at least) dwm's MODKEY to Mod4Mask a long time back. I did for about an hour, then switched it back. Mod4 is too close to (read: right next to) Ctrl on my keyboard, and isn't as easy to reach with my thumb while typing, so it slowed me down considerably. --Andrew Hills
Re: [dev] Sandy editor
> *Please*, use sane keybindings. Emacs and vi were made with a specific > keyboard from the 70s in mind. A time were the hjkl keys had little > arrows on them. A triangle layout (wqsd or ijkl for example) is much > easier to type. Puke. Triangle layout may be more intuitive to learn for single char/line movement, but is probably not easier to type. Certainly not WASD layout, laying on the weak fingers of the left hand. Vi's ergonomic problems lay with @ and ESC on the modern keyboard, not with hjkl. Does anyone *know* what sane keybindings are? Vi seems less insane than most to me (once you restore @ and ESC to their 70's positions, and swap CTRL / ALT), but - it's still pretty insane. - Noah
Re: [dev] Sandy editor
On Fri, May 27, 2011 at 8:26 PM, Noah Birnel wrote: > Puke. Triangle layout may be more intuitive to learn for single char/line > movement, but is probably not easier to type. Certainly not WASD layout, > laying on the weak fingers of the left hand. wasd is only an example... Pick another triangle layout if this one doesn't suit you. Besides, I use the same fingers with hjkl and ijkl so I really don't know what you're talking about. > Does anyone *know* what sane keybindings are? Vi seems less insane than > most to me (once you restore @ and ESC to their 70's positions, and swap That's a good improvement. Update the default layout to the most common keyboard type: ibm pc keyboard clone.
Re: [dev] Sandy editor
Sam has sane keybindins. On May 27, 2011 2:26 PM, "Noah Birnel" wrote: >> *Please*, use sane keybindings. Emacs and vi were made with a specific >> keyboard from the 70s in mind. A time were the hjkl keys had little >> arrows on them. A triangle layout (wqsd or ijkl for example) is much >> easier to type. > > Puke. Triangle layout may be more intuitive to learn for single char/line > movement, but is probably not easier to type. Certainly not WASD layout, > laying on the weak fingers of the left hand. > > Vi's ergonomic problems lay with @ and ESC on the modern keyboard, not > with hjkl. > > Does anyone *know* what sane keybindings are? Vi seems less insane than > most to me (once you restore @ and ESC to their 70's positions, and swap > CTRL / ALT), but - it's still pretty insane. > > - Noah > >
Re: [dev] Sandy editor
On 27 May 2011 10:46, Aurélien Aptel wrote: > On Fri, May 27, 2011 at 10:29 AM, Aurélien Aptel > wrote: > > arrows on them. A triangle layout (wqsd or ijkl for example) is much > > easier to type. > > I meant wasd (on qwerty), obviously. > > that would be just sweet for the myriads of colemak users like myself
[dev] suckless wget/curl
I think we can safely agree that both of these suck: -rwxr-xr-x 1 root root 123K 2011-01-26 20:11 /usr/bin/curl* -rwxr-xr-x 1 root root 346K 2011-02-20 12:05 /usr/bin/wget* Since I can't be the first to realize that, is there already a suckless alternative for simple HTTP/FTP data transfer? -- ilf Über 80 Millionen Deutsche benutzen keine Konsole. Klick dich nicht weg! -- Eine Initiative des Bundesamtes für Tastaturbenutzung signature.asc Description: Digital signature
Re: [dev] suckless wget/curl
I tend to use axel - http://axel.alioth.debian.org/ Regards, Stanislav Paskalev
Re: [dev] suckless wget/curl
Hi, On Fri, May 27, 2011 at 11:49:50PM +0200, ilf wrote: > I think we can safely agree that both of these suck: > > -rwxr-xr-x 1 root root 123K 2011-01-26 20:11 /usr/bin/curl* > -rwxr-xr-x 1 root root 346K 2011-02-20 12:05 /usr/bin/wget* > > Since I can't be the first to realize that, is there already a > suckless alternative for simple HTTP/FTP data transfer? why not use standard tools? , ls -lh /usr/bin/{wget,curl,ftp,GET}| sort -k5 | awk '{print $5, $9}' 14K /usr/bin/GET 70K /usr/bin/ftp 123K /usr/bin/curl 346K /usr/bin/wget -- -- Stefan Kuttler ==*== nc.netbeisser.de
Re: [dev] suckless wget/curl
> I think we can safely agree that both of these suck: > > -rwxr-xr-x 1 root root 123K 2011-01-26 20:11 /usr/bin/curl* > -rwxr-xr-x 1 root root 346K 2011-02-20 12:05 /usr/bin/wget* > > Since I can't be the first to realize that, is there already a suckless > alternative for simple HTTP/FTP data transfer? Maybe not suckless, but BSD fetch is a lot smaller (~23k).
Re: [dev] suckless games collection?
On Thu, May 26, 2011 at 11:01:51AM +0200, pancake wrote: > I found this chess implementation in obfuscated C. I'm sure than > cleaning it up > (deobfuscating it) will make it ready to be in the cathegory of > "suckless games" > > http://nanochess.110mb.com/chess1_es.html > > What do you think about creating a 'sgames' project? collecting > minimalistic simple > games? I wrote a word guess game few time ago named 'wg' which can be merged > into this project. Afair there was such a discussion about a year ago. Why not, if someone got nice ideas for sl-games... Deobfuscating might not be that much of a good idea, the code is meant to confuse so wth should you try to understand it? Attached is a small (RTFC-readable) chess implementation in 349 LOCs which supports en passant / castling and promotion. You might merge it into such a project if you want to, just send me an email if you do so. have fun v4hn pgpKRa1CE5J8H.pgp Description: PGP signature
Re: [dev] suckless games collection?
sorry for double post, missed the attachment. v4hn /* simple chess implementation by v4hn @ 2009 */ #include #include #include typedef enum { BLACK = 0x00, WHITE = 0x20 } chess_color; typedef unsigned short chess_move; typedef signed char chess_pos; typedef char* chess_board; #define IS_FREE(x) (x == 0x20) #define IS_PIECE(x) (x&(0x40)) #define IS(color, x) (!IS_FREE(x) && ((x&0x20) == color)) #define OPPONENT(color) ((chess_color) (color^0x20)) #define POS(x,y) ((chess_pos)(x-65)+((8-y)*8)) #define MOVE(f,t) ((chess_move)(((short) (f) << 8) | (t))) #define FROM(m) ((chess_pos)(m >> 8)) #define TO(m) ((chess_pos)(m & 0xFF)) void print_board(); int valid_pawn_move(chess_move m); int valid_rook_move(chess_move move); int valid_bishop_move(chess_move move); int valid_knight_move(chess_move move); int valid_king_move(chess_move move); int valid_castling_move(chess_color color, chess_move move); int is_reachable(chess_color color, chess_pos pos); int self_check_after(chess_color color, chess_move move); int is_valid(chess_color color, chess_move move); chess_move read_move(chess_color color); int do_move(chess_move move); int move(chess_color color); /* current board */ char* board; /* was the last move a wide pawn jump? (en passant possible)*/ chess_pos pawn_jump; /* is castling still allowed? */ char castling_possible[2]; inline int sgn(int x){ return (x < 0) ? -1 : 1; } void print_board(){ unsigned int row= 0, col= 0; printf("\n" " || A | B | C | D | E | F | G | H ||\n" "===\n"); for(row= 0; row < 8; row++){ printf("%d ||", 8-row); for(col= 0; col < 8; col++){ printf(" %c |", board[row*8+col]); } printf("| %d\n" "---\n", 8-row); } printf("===\n" " || A | B | C | D | E | F | G | H ||\n\n"); } int valid_pawn_move(chess_move m){ return ( IS(WHITE, board[FROM(m)]) ? ((FROM(m)/8 - TO(m)/8 == 1) && (FROM(m)%8 - TO(m)%8 == 0) && IS_FREE(board[TO(m)])) || ((FROM(m)/8 - TO(m)/8 == 1) && (abs(FROM(m)%8 - TO(m)%8) == 1) && (IS(BLACK, board[TO(m)]) || (pawn_jump == TO(m)+8))) || ((FROM(m)/8 - TO(m)/8 == 2) && FROM(m)%8 - TO(m)%8 == 0 && IS_FREE(board[FROM(m)-8]) && IS_FREE(board[TO(m)])) : ((TO(m)/8 - FROM(m)/8 == 1) && (TO(m)%8 - FROM(m)%8 == 0) && IS_FREE(board[TO(m)])) || ((TO(m)/8 - FROM(m)/8 == 1) && (abs(TO(m)%8 - FROM(m)%8) == 1) && (IS(WHITE, TO(m)) || pawn_jump == TO(m)-8)) || ((TO(m)/8 - FROM(m)/8 == 2) && TO(m)%8 - FROM(m)%8 == 0 && IS_FREE(board[FROM(m)+8]) && IS_FREE(board[TO(m)])) ); } int valid_rook_move(chess_move move){ chess_pos i; if((FROM(move)%8 != TO(move)%8) && (FROM(move)/8 != TO(move)/8)) return 0; i= FROM(move); while(i != TO(move) && IS_FREE(board[ i+= sgn(TO(move)-FROM(move)) * ((FROM(move)%8 == TO(move)%8)?8:1) ]) ); return (i == TO(move)); } int valid_bishop_move(chess_move move){ chess_pos i, last_round; if( (!((TO(move)-FROM(move))%9) && !((TO(move)-FROM(move))%7))) return 0; i= last_round= FROM(move); while(i != TO(move) && IS_FREE(board[ i+= sgn(TO(move)-FROM(move)) * ((TO(move)-FROM(move))%9 ? 7 : 9) ])){ if(abs(last_round/8 - i/8) != 1) return 0; last_round= i; } return (i == TO(move)); } int valid_knight_move(chess_move move){ return (abs(FROM(move)%8 - TO(move)%8) == 2 && abs(FROM(move)/8 - TO(move)/8) == 1) || (abs(FROM(move)%8 - TO(move)%8) == 1 && abs(FROM(move)/8 - TO(move)/8) == 2); } int valid_king_move(chess_move move){ return (abs(FROM(move)%8 - TO(move)%8) <= 1) && (abs(FROM(move)/8 - TO(move)/8) <= 1); } int valid_castling_move(chess_color color, chess_move move){ chess_pos i; switch(TO(move)&~0x20){ case 0: if(castling_possible[color == WHITE]%2 == 0) return 0; for(i= 5+8*(color == WHITE ? 7 : 0); i%8 != 7; i++) if(!IS_FREE(board[i])) return 0; for(i= 5+8*(color == WHITE ? 7 : 0); i%8 != 7; i++) if(is_reachable(OPPONENT(color), i)) return 0; break; case 1: if(castling_possible[color == WHITE] < 2) return 0; for(i= 1+8*(color == WHITE ? 7 : 0); i%8 != 4; i++) if(!IS_FREE(board[i])) return 0; for(i= 2+8*(color == WHITE ? 7 : 0); i%8 != 5; i++) if(is_reachable(OPPONENT(color), i)) return 0; break; default: return 0; } return 1; } int is_reachable(chess_color color, chess_pos pos){ chess_pos i; for(i= 0; i < 65; i++){ if(is_valid(color, MOVE(i, pos))) break; } return (i != 65); } int self_check_after(chess_color color,
Re: [dev] suckless wget/curl
On 05-28 00:00, u...@netbeisser.de wrote: why not use standard tools? 14K /usr/bin/GET 70K /usr/bin/ftp /usr/bin/GET: symbolic link to `lwp-request' /usr/bin/lwp-request: a /usr/bin/perl -w script text executable -- ilf Über 80 Millionen Deutsche benutzen keine Konsole. Klick dich nicht weg! -- Eine Initiative des Bundesamtes für Tastaturbenutzung signature.asc Description: Digital signature
Re: [dev] suckless wget/curl
Here's one I wrote: http://github.com/jeffwar/wgetlite 26K without debugging symbols, unfortunately it doesn't statically link yet (getaddrinfo), but it'll be pretty trivial to sort it.
Re: [dev] suckless wget/curl
Hey, Here's one I just hacked together for fun. It uses netcat. It understands redirects, but that's it. -8<- #!/bin/sh if test $# -ne 1; then echo "usage: $0 url" >&2 exit 1 fi wget (){ url="$(echo "$1" | sed 's/^http:\/\///')" host="$(echo "$url" | sed 's/\/.*//')" path="$(echo "$url" | sed 's/[^/]*//')" printf "GET $path HTTP/1.1\r\nHost: $host\r\n\r\n" | nc -vv -w 1 "$host" 80 ( read http code mesg if test "$code" -eq 200; then while read header; do if test "$header" = "$(printf '\r')"; then break fi done cat elif test "$code" -eq 301 -o "$code" -eq 302 -o "$code" -eq 307; then while read key val; do if test "$key" = 'Location:'; then wget "$val" break fi done else echo "unknown http code: $code $mesg" fi ) } wget "$1" -8<- Thanks, cls
Re: [dev] suckless wget/curl
On 28 May 2011 00:34, Connor Lane Smith wrote: > Here's one I just hacked together for fun. It uses netcat. It > understands redirects, but that's it. Except I made a typo on line 10 -- 's/(/|(/' -- and it doesn't work for every site, it seems. I'll probably work out why when I have more time. Still, I thought it was cute. cls
Re: [dev] suckless wget/curl
> Since I can't be the first to realize that, is there already a > suckless alternative for simple HTTP/FTP data transfer? I find snarf very handy for http/ftp/gopher transfers. Maybe it sucks less. http://www.xach.com/snarf/ jgw
***SPAM*** Re: [dev] suckless wget/curl
> Except [...] it doesn't work for every site, it seems. I'll probably > work out why when I have more time. Might be chunked transfer encoding. At least that was the first thing that came to mind looking at your code. > Still, I thought it was cute. Yes, I actually liked it. Chunked transfer encoding might make coding wget with netcat and the shell impossible though. -- Eckehard Berns
Re: [dev] suckless wget/curl
On Fri, May 27, 2011 at 3:49 PM, ilf wrote: > Since I can't be the first to realize that, is there already a suckless > alternative for simple HTTP/FTP data transfer? NetSurf uses curl, but wants to get rid of it. It might be worth: a) looking at their plans for a fetch implementation, or b) if there is already a suckless one, pointing it out to them so they can use it. I don’t think they have implemented anything yet. -- Anthony J. Bentley
Re: [dev] suckless wget/curl
If you're a fan of Plan 9, there's hget[1], which handles HTTP and FTP. It's not in 9base, since it requires a couple of other libraries, but you can get it in P9P. Alternatively you can grab a copy of Federico's Abaco[2] web browser, which bundles webfs and lets you mount the web as a 9P file system and use webget to fetch URLs. That can be a bit buggy, iirc, but it's a neat idea. [1]: http://swtch.com/plan9port/man/man1/hget.html [2]: http://lab-fgb.com/abaco/ Thanks, cls
Re: [dev] Sandy editor
On Fri, May 27, 2011 at 10:55:53PM +0200, Arian Kuschki wrote: > On 27 May 2011 10:46, Aur?lien Aptel wrote: > > > On Fri, May 27, 2011 at 10:29 AM, Aur?lien Aptel > > wrote: > > > arrows on them. A triangle layout (wqsd or ijkl for example) is much > > > easier to type. > > > > I meant wasd (on qwerty), obviously. > > > > that would be just sweet for the myriads of colemak users like myself Colemak user here. Most of the time I'm editing with sam, however if for whatever reason I do use vim, I have the hjkl keybindings remapped to colemak's neio. This is shifted over one key to the right (qwerty jkl;), but I think it makes much more sense since that's where you hand is placed already. I also have tab mapped to escape (with shift-tab inserting a literal tab character).
Re: [dev] Sandy editor
I asked around, found about a couple of very keybind maps using only Control: http://www.wordstar.org/wordstar/history/wmvswscmds.htm Then again they do not implement the unix standard ^U ^W ^H, which sucks a bit. Also, WordMaster may be unfeasible straight up as the Return key generates ^J and all, but this might be another starting point.