piotrlegnica / stuff
Various stuff and utilities.
Clone this repository (size: 34.0 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/piotrlegnica/stuff/
| commit 10: | 962e7a96da62 |
| parent 9: | ecf395871b1d |
Added m3u-to-pls.py.
| filename | size | last modified | ||
|---|---|---|---|---|
| .hgignore | 57 B | 5 weeks ago | Added brainfuck.py. | |
| HLQuery.py | 9.7 KB | 5 months ago | Initial. | |
| HLQuery1.py | 4.8 KB | 5 months ago | Initial. | |
| README.rst | 4.9 KB | 2 weeks ago | Added m3u-to-pls.py. | |
| bigints-add.cpp | 1.8 KB | 5 months ago | Initial. | |
| brainfuck.py | 5.0 KB | 5 weeks ago | Added brainfuck.py. | |
| cpp-comments-filter.cpp | 1.7 KB | 5 months ago | Initial. | |
| dns.py | 5.5 KB | 5 months ago | Initial. | |
| du.py | 11.7 KB | 5 months ago | Initial. | |
| dummy.c | 103 B | 5 months ago | Initial. | |
| icon.cpp | 2.9 KB | 5 months ago | Added icon.cpp. | |
| jobs.cpp | 776 B | 5 months ago | Initial. | |
| m3u-to-pls.py | 1.8 KB | 2 weeks ago | Added m3u-to-pls.py. | |
| make-fourcc.py | 407 B | 5 months ago | Initial. | |
| myepisodes.py | 1.9 KB | 4 months ago | Added myepisodes.py. | |
| qa.py | 1.5 KB | 4 months ago | Simplified last expression a bit, by importing division… | |
| scheduler.py | 1.6 KB | 3 months ago | Added scheduler.py. | |
| seh.c | 342 B | 5 months ago | struct _EXCEPTION_POINTERS* -> PEXCEPTION_POINTERS. | |
| tree.cpp | 1.2 KB | 5 months ago | Initial. | |
| writeColor.py | 2.1 KB | 5 months ago | Initial. |
README
PiotrLegnica's Stuff
You might find some of those useful. Or not. Released under WTFPL license, unless source says otherwise. And it probably requires Windows and Python 2.6 anyway.
I also have my own django-trunk-patches patch queue.
What's inside
- bigints-add.cpp
- Written one day (for SPOJ probably) - very basic and very naive implementation of bigint addition in C++, using std::list<char> (i.e. a linked list of digits) as integer type. Uses base-10 internally, so it requires some memory, but it works. I'm pretty sure there's much room for improvement.
- brainfuck.py
- My awesome Brainfuck compiler. Generates flat assembler source code for either Linux (using ELF formatter and syscalls for I/O) or Windows (using PE console formatter and msvcrt's getchar/putchar for I/O).
- cpp-comments-filter.cpp
- Like above; removes C++ comments (single- and multiline) from stdin, and outputs result to stdout, using simple state machine. Probably can be improved, too.
- dns.py
A (very) prototype (proof-of-concept) DNS records management util. Not very useful in itself, but comes with tinydns record file generator - with support for SRV records! It's ZODB3 powered (pretty heavy for such a small script, huh?), and has some level of input validation (I'm open to more suggestions!). Usage:
dns.py dom add <domain> - adds domain dns.py dom del <domain> - removes domain dns.py rec <domain> <type> <subdomain> - adds record <type> for <subdomain>.<domain> <subdomain> may be empty, or a wildcard (*). dns.py data - generates tinydns-data-compatible data file
- du.py
- A "disk usage" script, that can render nice colored tree, and shows progress as it counts. Usage: du.py <path> [<max. tree nesting>]. If tree nesting is not given, tree is not rendered. I use it often, so it definitely works.
- dummy.c
- A "do nothing" /SUBSYSTEM:WINDOWS program. I use this as "debugger" for applications that I don't want to run at all. Just create a REG_SZ named Debugger under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\<application>.
- HLQuery.py, HLQuery1.py
- Two versions of UDP HLDS server query library. Written in January 2008, and used somewhere around then for Counter-Strike 1.6 server monitor. I have no idea why there are two versions, and which one works better. Go ahead and try.
- icon.cpp
- Written as an overblown example of GetClassLong - an icon stealer application. It opens given PID, fetches icon of process' first window, and creates its own micro-window with that icon. It's cool, but might not work with every application, as it does very limited window enumeration. Usage: icon <pid>.
- jobs.cpp
- Written as an example - Windows' job objects. Watch with Process Explorer to see it.
- m3u-to-pls.py
- Simple M3U to PLS converter. Supports multiple file input and URL fetching.
- make-fourcc.py
- Small util to convert four character code into big- or little-endian hex integer constant. Usage: make-fourcc.py XXXX [little/big]. Little endian is default.
- myepisodes.py
- MyEpisodes.com RSS to iCalendar converter. Old and not so beautiful, but does the job. Requires Python 2.5, icalendar and feedparser. CGI script for now (I'm very slowly working on WSGI-compliant rewrite).
- qa.py
- Small self-test application - I used it to learn e.g. German irregulars, by repeating them over and over. Supports UTF-8 (obviously), but you might need to change console codepage. It reads simple database in format correct answer :: question, shuffles the questions, logs progress, and displays correct percentage (i.e. it's neat and cool). Code probably sucks, but who cares, it works. And it's been tested with py2exe.
- scheduler.py
- Very, very, very simple "task scheduler" (there's maybe 20 lines of real code). Probably requires Python 2.5, but who knows.
- seh.c
- Written as an example - the simplest SEH unhandled exception catcher ever.
- tree.cpp
- Simple non-templated tree written for somebody as simple way to hold directory hierarchy. There are absolutely no error-handling or correct memory management, but shows a simple tree and how to print it recursively just fine, IMHO.
- writeColor.py
- A portable (I think) "writeColor" function, which uses either Console API on Windows, or ANSI escape codes on other platforms. Usage: writeColor(text, foreground, background, terminator), where background and terminator are optional (terminator defaults to \n). Probably could be improved, feel free to send patches. See code for color table (append "-bold" to use brighter versions).
