S010's homepage

 


Tags:
c, double click for console, fun, programming, shell, shell script, system programming, text game, utility, windows

op.sh

ctime:2009-11-11 01:41:58
mtime:2009-11-11 01:42:32

Here's a nice little shell script, it's an analog to GUI's double-click concept.

Example usage: op doc1.pdf pic1.jpg ...

http://s010.lv/files/op.sh

Will add a more thorough description later xD

Window Closer

ctime:2009-11-10 14:03:08
mtime:2009-11-10 14:03:08

Type: utility
OS: Windows
Download: source + exe
Screenshot:

When I work at the computer for a few hours, a hell lot of open windows accumulate. I got tired of closing them by hand, so I decided to write this utility to do that for me.

This program allows you to close all windows, captions of which match the string you enter. Two wildcards are supported: '*' — stands for zero or more characters; '?' — stands for one character. Minimizes to system tray.
It's writen in pure C + WinAPI, therefore it's very fast and needs very little memory.

threedoors.c

ctime:2009-11-10 12:22:06
mtime:2009-11-10 13:02:56

Imagine that you are a player on a TV quiz show, the host asks you to choose one of the three doors, behind one of them -- is a valuable prize. You make your choice and then the host opens one of the doors that are left, behind which there is no prize and asks you whether you would like to change your selection and choose the other door out of two that remain closed. Will your chances of winning increase if you change your mind?

s@slowpoke:1:~/src/svn/my/games/threedoors$ ./threedoors +--------+ +--------+ +--------+ | | | | | | | | | | | | | | | | | | | | | | | | | o | | o | | o | | | | | | | | | | | | | +--------+ +--------+ +--------+ (1) (2) (3) You are a player on a TV-quiz show,the host offers you to choose one of the three doors,behind one of them is a brand new car,behind other two are goats.Which door will you choose?> ...

shell.c

ctime:2009-11-10 12:22:06
mtime:2009-11-10 13:10:14

This is a very primitive but a real nonetheless UNIX shell. It parses the line entered, builds a parse tree and executes it. I wrote it mainly for lulz.

Supported operators:

&&
AND operator, same as in common shells
||
OR operator, same as in common shells
;
execute mutliple commands in one line
&
execute in background
><
suppress any kind of output (stdout and stderr); liek stfu! ><
>
redirect stdout to file
^>
redirect stderr to file
>>
append stdout to file
<
redirect stdin from file
!
NOT operator, for use with AND and OR

Example run:
s:/home/s/src/svn/my/misc/shell$ ls asd && ls /AND EVAL ls asd EVAL ls / trav_tree(): pid=17910trav_tree(): pid=17910ls: asd: No such file or directorys:/home/s/src/svn/my/misc/shell$ ls asd || ls /OR EVAL ls asd EVAL ls / trav_tree(): pid=17910trav_tree(): pid=17910ls: asd: No such file or directorytrav_tree(): pid=17910altroot bin boot bsd bsd.rd dev etchome mnt root sbin stand sys tmpusr vars:/home/s/src/svn/my/misc/shell$

Compiles like cc -lreadline -lcurses -o shell shell.c.

f.c

ctime:2009-11-10 12:22:06
mtime:2009-11-10 13:04:39

A small program that forks the given command into background (thus, it doesn't depend on the terminal anymore and doesn't appear in the jobs list) with the given parameters.

Can redirect stdin, stdout and stderr. Create files .f/redir_stdin, .f/redir_stdout and .f/redir_stderr in your home directory, with the lists of programs for which to redirect IO. (One command per line, no leading or trailing whitespace allowed (except for newline ofcourse)). You can also create the file .f/invert to invert the meanings of the previous files -- only programs listed are not redirected.
All three streams are redirected to /dev/null.

Example usage:
f gqview
f leafpad some_file.txt