> Sford wiki > Sford cheat sheets
I may fix the wikitext and break this into separate pages some day.
This document contains misc info that sford always forgets.
The latest version of this document can be found at http://wiki.geeky-boy.com/w/index.php?title=Sford_cheat_sheets
This document contains misc info that I always forget. I do not guarentee that any of this information is correct or even useful to anybody except myself. See http://geeky-boy.com/standard/ for my standard disclaimer and copyright.
Signal-safe functions: http://man7.org/linux/man-pages/man7/signal-safety.7.html
#include <unistd.h> #include <string.h> #include <signal.h> #include <pthread.h> #include <semaphore.h> sem_t sleep_sem; void sig_handler(int signum) { static char sig_name[] = "alarm\n"; write(1, sig_name, strlen(sig_name)); sem_post(&sleep_sem); } int main(int argc, char **argv) { sem_init(&sleep_sem, 0, 0); struct sigaction sa; sa.sa_handler = &sig_handler; sa.sa_flags = SA_RESTART; sigemptyset(&sa.sa_mask); /* Allow other signals to interrupt this one. */ sigaction(SIGALRM, &sa, NULL); alarm(3); /* Wake up in 3 sec. */ sem_wait(&sleep_sem); return 0; }
Advanced Package Tool (APT): higher-level package manager than dpkg and . Aptitude: ncurses front-end.
sudo apt-get install pkgname # install individual package (and its dependencies). sudo apt-get update # update available packages list. sudo apt-get upgrade # get latest versions of packages. sudo apt-cache search searchpat # good for finding which package contains a command. sudo dpkg -i PathToDotDebFile.deb # install .deb file
apt-get remove packagename
- remove the binaries, but not the configuration or data files of the package packagename. It will also leave dependencies installed with it on installation time untouched.
apt-get purge packagename
or apt-get remove --purge packagename
- will remove about everything regarding the package packagename, but not the dependencies installed with it on installation. Both commands are equivalent. Particularly useful when you want to 'start all over' with an application because you messed up the configuration. However, it does not remove configuration or data files residing in users home directories, usually in hidden folders there. There is no easy way to get those removed as well.
apt-get autoremove
- removes orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren't any longer. Use this after removing a package which had installed dependencies you're no longer interested in.
aptitude remove packagename
or aptitude purge packagename
(likewise) will also attempt to remove other packages which were required by packagename on but are not required by any remaining packages.
sudo apt-get install debhelper # if not installed. cd chip-power/chip-power sudo dpkg-buildpackage -us -uc # build .deb package file. cd .. sudo dpkg -i chip-power_0.6_all.deb # install .deb package.
$ cd ~ $ git config --global user.name "Steve Ford" $ git config --global user.email sford@geeky-boy.com $ git config --global core.editor vim $ git config --list core.excludesfile=~/.gitignore core.legacyheaders=false core.quotepath=false core.pager=less -r mergetool.keepbackup=true push.default=simple color.ui=auto color.interactive=auto repack.usedeltabaseoffset=true alias.s=status alias.a=!git add . && git status alias.au=!git add -u . && git status alias.aa=!git add . && git add -u . && git status alias.c=commit alias.cm=commit -m alias.ca=commit --amend alias.ac=!git add . && git commit alias.acm=!git add . && git commit -m alias.l=log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset' alias.ll=log --stat --abbrev-commit alias.lg=log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative alias.llg=log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit alias.d=diff alias.master=checkout master alias.spull=svn rebase alias.spush=svn dcommit alias.alias=!git config --list | grep 'alias\.' | sed 's/alias\.\([^=]*\)=\(.*\)/\1\ => \2/' | sort include.path=~/.gitcinclude include.path=.githubconfig include.path=.gitcredential diff.exif.textconv=exif credential.helper=osxkeychain user.name=Steve Ford user.email=sford@geeky-boy.com core.editor=vim
$ cd ~ $ mkdir src $ cd src $ git clone https://github.com/fordsfords/semlit Cloning into 'semlit'... remote: Counting objects: 133, done. remote: Total 133 (delta 0), reused 0 (delta 0), pack-reused 133 Receiving objects: 100% (133/133), 122.83 KiB | 0 bytes/s, done. Resolving deltas: 100% (71/71), done. Checking connectivity... done. $ cd semlit $ ./bld.sh $ cp -v bin/* ~/bin/ bin/semlit.pl -> /Users/sford/bin/semlit.pl bin/semlit.sh -> /Users/sford/bin/semlit.sh $ cd ..
$ cd ~/src $ git clone https://github.com/UltraMessaging/UMExamples Cloning into 'UMExamples'... remote: Counting objects: 122, done. remote: Compressing objects: 100% (86/86), done. remote: Total 122 (delta 42), reused 110 (delta 32), pack-reused 0 Receiving objects: 100% (122/122), 71.65 KiB | 0 bytes/s, done. Resolving deltas: 100% (42/42), done. Checking connectivity... done. $ cd UMExamples $ ./bld.sh bld.sh: Info: c/check_flight_size_ewouldblock.sldoc: building semiliterate doc bld.sh: Info: c/context_create.sldoc: building semiliterate doc bld.sh: Info: c/minsrc.sldoc: building semiliterate doc bld.sh: Info: java/minsrc.sldoc: building semiliterate doc bld.sh: Info: c/source_create.sldoc: building semiliterate doc bld.sh: Info: building html index files $ $ git log --pretty=oneline ed695dfc52b83b189f6fac24f476039abb3874dc Merge branch 'gh-pages' b2659718cd487f907041eae3d2444f1eef870881 Minor change 6775ff050044a27b2ddae90a466fa47075b8d55b Merge branch 'master' into gh-pages b7a3bc43e624001be7a35c6e13f61c103a531a1c Changed everything. :-) de9118714c98dd1f4c282f97620db116dd093dcb removing weird \ file a3d45704e959e19f713f2e429f64ef47e94b910b adding link the example html pages 9a797c7d0951f3a3177f825de976fe66ead02e21 initial commit of UMExamples with 4 samples and directory structure 1ab2ce36abd37b542f8140dde7fe059dad23febf Initial commit $ cd ..
$ cd ~/src/UMExamples/ $ vi minsrc/c/minsrc_c.slsrc
(in line 21, change "program" to "macro")
$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: minsrc/c/minsrc_c.slsrc no changes added to commit (use "git add" and/or "git commit -a") $ git add --dry-run --all add 'minsrc/c/minsrc_c.slsrc' $ git add --all $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: minsrc/c/minsrc_c.slsrc $ git commit [master 7cc16f2] Fixed comment 1 file changed, 1 insertion(+), 1 deletion(-)
(could have skipped the "git add" and instead used "git commit -a" to stage and commit)
$ git remote -v origin https://github.com/UltraMessaging/UMExamples (fetch) origin https://github.com/UltraMessaging/UMExamples (push) $ git push origin master Username for 'https://github.com': fordsfords Password for 'https://fordsfords@github.com': Counting objects: 5, done. Delta compression using up to 4 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 427 bytes | 0 bytes/s, done. Total 5 (delta 4), reused 0 (delta 0) To https://github.com/UltraMessaging/UMExamples ed695df..7cc16f2 master -> master
$ git checkout gh-pages Switched to branch 'gh-pages' Your branch is up-to-date with 'origin/gh-pages'. $ git merge master
(a bunch of earlier changes are listed)
$ git push origin gh-pages Total 0 (delta 0), reused 0 (delta 0) To https://github.com/UltraMessaging/UMExamples b265971..c63cd86 gh-pages -> gh-pages $ git checkout master Switched to branch 'master' Your branch is up-to-date with 'origin/master'.
$ git fetch origin remote: Counting objects: 10, done. remote: Compressing objects: 100% (10/10), done. remote: Total 10 (delta 2), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (10/10), done. From https://github.com/UltraMessaging/UMExamples 7cc16f2..385846b master -> origin/master
(this fetches to local repo, but does not merge into my current work area)
$ git merge Updating 7cc16f2..385846b Fast-forward .../c/check_flight_size_ewouldblock.slsrc.html | 247 +++++++-------------- .../check_flight_size_ewouldblock_store.slsrc.html | 133 ++--------- setting_attributes/README.txt | 5 + 3 files changed, 110 insertions(+), 275 deletions(-) create mode 100644 setting_attributes/README.txt
(could use "git pull" instead of "git fetch"/"git merge")
The following is stolen, lock, stock, and barrel, from http://grammar.ccc.commnet.edu/grammar/marks/quotation.htm
Use quotation marks to set off material that represents quoted or spoken language. Quotation marks also set off the titles of things that do not normally stand by themselves: short stories, poems, and articles. Usually, a quotation is set off from the rest of the sentence by a comma; however, the typography of quoted material can become quite complicated. Here is one simple rule to remember:
In the United States, periods and commas go inside quotation marks regardless of logic. Click HERE for an explanation (sort of).
In the United Kingdom, Canada, and islands under the influence of British education, punctuation around quotation marks is more apt to follow logic. In American style, then, you would write: My favorite poem is Robert Frost's "Design." But in England you would write: My favorite poem is Robert Frost's "Design". The placement of marks other than periods and commas follows the logic that quotation marks should accompany (be right next to) the text being quoted or set apart as a title. Thus, you would write (on either side of the Atlantic):
Further, punctuation around quoted speech or phrases depends on how it fits into the rest of your text. If a quoted word or phrase fits into the flow of your sentence without a break or pause, then a comma may not be necessary:
Following a form of to say, however, you'll almost always need a comma:
If the quoted speech follows an independent clause yet could be part of the same sentence, use a colon to set off the quoted language:
When an attribution of speech comes in the middle of quoted language, set it apart as you would any parenthetical element:
Be careful, though, to begin a new sentence after the attribution if sense calls for it:
Convention normally insists that a new paragraph begins with each change of speaker:
In proofreading and editing your writing, remember that quotation marks always travel in pairs! Well, almost always. When quoted dialogue carries from one paragraph to another (and to another and another), the closing quotation mark does not appear until the quoted language finally ends (although there is a beginning quotation mark at the start of each new quoted paragraph to remind the reader that this is quoted language). Also, in parenthetical documentation (see the Guide to Writing Research Papers), the period comes after the parenthetical citation which comes after the quotation mark" (Darling 553).
In reporting "silent speech".noting that language is "said," but internally and not spoken out loud.writers are on their own. Writers can put quotation marks around it or not:
Some writers will set such unspoken language in italics or indent it in order to set it off from other "regular" language. That's probably not a good idea if there is a lot of it because the indents can be confusing and italics can become tiresome to read after a while. The decision will probably depend on the amount of silent speech within the text. Probably the best way to handle silent speech is to find an author whom you like who does a lot of this.Graham Swift in his novel Last Orders, for instance.and copy that author's style. Consistency, of course, is very important.
Some interesting things can happen with verb tenses when we report action in indirect or reported speech ("The president said that he was going to Egypt tomorrow"). For help with this issue, we would refer to you Professor Mary Nell Sorensen's Web site at the University of Washington.
Be careful not to use quotation marks in an attempt to emphasize a word (the kind of thing you see in grocery store windows.Big "Sale" Today!). Underline or italicize that word instead. (The quotation marks will suggest to some people that you are using that word in a special or peculiar way and that you really mean something else.or that your sale is entirely bogus.)
The American Medical Association Manual of Style (9th ed, 1998) calls misused quotation marks like this Apologetic Quotation Marks and says:
Quotation marks used around words to give special effect or to indicate irony are usually unnecessary. When irony or special effect is intended, skillful preparation can take the place of using these quotes. Resort to apologetic quotation marks or quotation marks used to express irony only after such attempts have failed, keeping in mind that the best writing does not rely on apologetic quotation marks. (p 220)
Refer to Guide to Writing Research Papers and, especially, the English faculty's Suggestions for Writing Papers for Literature Courses for further help in handling quotations.
We do not enclose indirect quotations in quotation marks. An indirect quotation reports what someone says but not in the exact, original language. Indirect quotations are not heard in the same way that quoted language is heard.
Double Punctuation with Quotations
Occasionally - very occasionally, we hope - we come across a sentence that seems to demand one kind of punctuation mark within quotation marks and another kind of punctuation mark outside the quotation marks. A kind of pecking order of punctuation marks takes over: other marks are stronger than a period and an exclamation mark is usually stronger than a question mark. If a statement ends in a quoted question, allow the question mark within the quotation marks suffice to end the sentence.
On the other hand, if a question ends with a quoted statement that is not a question, the question mark will go outside the closing quotation mark.
If a question ends with a quotation containing an exclamation mark, the exclamation mark will supersede the question and suffice to end the sentence.
A single question mark will suffice to end a quoted question within a question:
Authority for this section: New York Public Library Writer's Guide to Style and Usage HarperCollins: New York. 1994. 277. Cited with permission, examples our own.
Single Quotation Marks
In the United States, we use single quotation marks to enclose quoted material (or the titles of poems, stories, articles) within other quoted material:
British practice, again, is quite different. In fact, single-quote marks and double-quote marks are apt to be reversed in usage. Instructors in the U.S. should probably take this into account when reading papers submitted by students who have gone to school in other parts of the globe.
In newspapers, single quotation marks are used in headlines where double quotation marks would otherwise appear.
One further use, according to the Chicago Manual of Style: in philosophical discourse, key concepts may be set apart with single-quote marks. When such concepts are set off in this way, periods and commas go outside the single-quote marks:
Ref: http://www.docbook.org/tdg/en/html/docbook.html
More doc: http://www.sagehill.net/docbookxsl/
"Include" files:
<b> <!ENTITY ch01 SYSTEM "ch01.sgm"> ... &ch01; </b>
http://www.madore.org/~david/computers/connect-intr.html - Blocking connect socket call can get EINTR and it's a pain to deal with.
class XClass { public $xcolor; private $xorientation; static $num_instances = 0; public const RIGHT = 1; function __construct($orient = 2) { // default value for parameter $this->xorientation = $orient; // $this-> == $instance_var-> $this->num_instances ++; } function __destruct() { if ($this->num_instances <= 0) throw new Exception("Oops"); $this->num_instances --; } private function set_orientation($orient) { $this->orientation = $orient; } public function turn_right() { $this->set_orientation($this->orientation + self::RIGHT); // self:: == ClassName:: } static function instance_count() { return $this->num_instances; } } $x = new XClass; // could also include (5) $x->turn_right(); unset($x); print XClass::instance_count();
JMS docs: http://java.sun.com/products/jms/docs.html
Data Type | ILP32 size | LP64 size |
char | 8 | unchanged |
short | 16 | unchanged |
int | 32 | unchanged |
long | 32 | 64 |
long long | 64 | unchanged |
pointer | 32 | 64 |
enum | 32 | unchanged |
float | 32 | unchanged |
double | 64 | unchanged |
long double | 128 | unchanged |
Also, note that Solaris uses "LD_LIBRARY_PATH_64" for 64-bit executables, or "LD_LIBRARY_PATH" if "..._64" is not defined. To enable 64-bit compiles, use "-xarch=v9".
The above table describes the data model for most (all?) Unix platforms. However, Microsoft felt the need to do it differently, so 64-bit Windows LONG is 32-bits. See http://msdn2.microsoft.com/en-us/library/s3f49ktz(VS.80).aspx
"Rosetta Stone for Unix" http://bhami.com/rosetta.html
Normal file protection: file mode. chmod. Linux extended file permissions: attributes. lsattr and chattr. See https://wiki.archlinux.org/index.php/File_permissions_and_attributes#File_attributes
advanced-linux-programming.pdf
http://www.faqs.org/faqs/Solaris2/FAQ/ - Solaris 2 FAQ (master ftp://ftp.wins.uva.nl/pub/solaris)
Library stuff: env var "LD_PRELOAD": http://uberhip.com/godber/interception/html/slide_5.html and http://developers.sun.com/solaris/articles/lib_interposers_code.html#malloc_interposer.c Shared libraries: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
HPUX - no /var/adm/messages file, see instead "/var/adm/syslog/syslog.log". No /etc/rc.d directory, see instead "/sbin/rc*". Also, "/usr/lib/netsvc/fs/autofs/automountd".
Signal handling - if writing a library routine that needs to handle a signal (e.g. SIGPIPE in a function that writes to a socket), then it should save and restore the caller's signal handler. Use sigaction (SVr4) or sigvec (BSD) so that extra flags can be saved and restored. But having lib routines do that is not recommended. For one thing, there is only one signal handler for an entire multi-threaded process. By having the lib routine set it's own handler, even temporarily, leaves a potential race condition where the wrong handler will catch a given signal. Also, if an application thread establishes a signal handler during our execution, then *we* won't catch *our* signal. And we could restore the "wrong" handler, especially if both the applic and the lib do save/restore.
iconv <x.csv -f UTF-16 -t UTF-8
if [ -f "/usr/nawk" ]; then AWK="nawk"; else AWK=awk; fi echo 4.00.00-rc1 | $AWK '{gsub(/\./,"_",$0);print "SDK_" $0}' id | $AWK '{split($0, a, /[()]/);print "user=" a[2]}'
echo $LONGLINE | perl -nlae 'foreach (@F) {print;}'
(-n=Loop, -l=Chomp&PrintNl -a=AutoSplit -e=Src) Just remember that (unlike awk) the array of fields (@F) is zero-based, not one-based. You can also include "-Fx" where "x" is a delim character.
Berkely-based: Solaris /usr/ucb/sum - Berkely with 1024-byte blocks (no options). Cygwin sum - Berkely with 1024-byte blocks. The "-s" option makes it Sysv (with 512-byte blocks). Linux /usr/bin/sum - same as Cygwin sum. Aix /bin/sum - Berkely with 1024-byte blocks. The "-o" option gives the checksum as sysv <em>but with half the block count (+/- 1)</em>. Tru64 /bin/sum - Same as Aix /bin/sum. Tru64 /usr/local/gnu/bin/sum - same as Cygwin sum. Sysv-based: Solaris /bin/sum - Sysv with 512-byte blocks. The "-r" option gives the same checksum as Berkely <em>but with double the block count (+/- 1)</em>. Hpux /usr/bin/sum - same as Solaris /bin/sum. MKS sum - same as Solaris /bin/sum. Irix /bin/sum - same as Solaris /bin/sum
For more sed info (including Windows sed), see http://www.student.northpark.edu/pemente/sed/ and http://sed.sourceforge.net/
> -mtime 3 # between 3 and 4 days ago > -mtime +3 # more than 4 days ago > -mtime -3 # less than 3 days ago > > so, using a timeline, we have > > |--------|--------|--------|--------|--------|- .. going back in time > now 1 2 3 4 5 > > <----------- -3 -----------><-- 3 -->< ------ +3 -------- ...
mt -f /dev/rmt/0 rewind dd <x.tar of=/dev/rmt/0n obs=10k <em>(makes exact duplicate of 1st tape)</em>
findbug -p T4.7BP1 -u fords '(' status '==' A '||' status '==' O ')' '||' '(' Resolved-on '>' YYMMDD '&&' Resolved-on '!=' "" ')' >bug_list_AO.fords findbug -p T4.7BP1 -u fords Resolved-on '<=' YYMMDD '&&' Resolved-on '!=' "" >bug_list_R.fords
find . -type f -print | egrep -v "/htdocs/|/icons/" >txt_files file `cat txt_files` | egrep -v "text$|script$" <em>(That line listed 3 files, which I removed from "txt_files")</em> for F in `cat txt_files`; do tr -d '\r' <$F >$F.t; cat $F.t >$F; rm $F.t; done
niscat mail_aliases.org_dir
struct rlimit rl; rl.rlim_max = 1024; rl.rlim_cur = 1024; stat = setrlimit(RLIMIT_NOFILE, &rl); /* 0=success, -1:errno */
If need more than 1024, see 3.45 in the Solaris 2 FAQ.
I=2 eval X$I=\"test 1 2 3\" eval Y=\"\$X$I\" echo $Y
Snoop is solaris-only. It normally requires root privilage to run it, but I've modified systems to allow anybody to use it (set ownership to root and set the "set-uid" bit: "chmod 4555 snoop").
Linux has a similar tool: "tcpdump". (It is located in /usr/local/sbin, which is not normally in the PATH, so you need to explicitly call it out.)
I don't know tcpdump very well, so I'll concentrate on snoop.
Snoop normally outputs to the screen, but over the years I've kicked myself over and over again for using it that way. I don't know how many times I've run it and the interesting stuff scrolls off the screen and it's hard to reproduce what I'm looking for. So now I use it's storage mode. Use the "-o outfile" instead of STDOUT redirection! It saves more info that way.
The output file generated by "-o" is not ascii. You need to use snoop to read and display its contents ("-i infile"). This is actually a Good Thing, because you can use all of snoop's selection and filtration when displaying packets. And you can change your mind as often as you like as to how much info to display.
As a result, always capture more packets than you want. Cast your net wide, and then use snoop's packet selection power during the display phase. It's easy to display less than you capture; it's impossible to display more than you capture.
The easiest way to use it is "snoop -o ofile". This will capture every packet transferred. Unfortunately, that will include telnet traffic. So, in spite of my warning to cast your net wide, I usually do restrict the capture to packets between the two systems you're interested in. (Also, make sure your telnet session is not nested through the remote host. I.e. I might telnet to host1, and from there telnet to host2. If I then snoop host1 from host2, it will capture all that stupid telnet traffic.)
So, if you're running your client on the local system, and server is running on host1, enter:
snoop -o ofile quad001
This will capture packets both sent and received. You will need to use "ctrl-c" to stop it.
Then, to display it, enter:
snoop -i x -x 0 -t r | more
The "-x 0" tells it to dump the contents of the packet in hex, starting with offset 0 within the packet. The "-t r" tells it to display timestamps relative to the receipt of the first packet (by default it displays time *between* the packets).
Cygwin is a UNIX environment for Windows. See http://www.cygwin.com/ for more info and the latest download. The Cygwin user's guide is at http://sources.redhat.com/cygwin/cygwin-ug-net/cygwin-ug-net.html and the FAQ is at http://www.cygwin.com/faq/
"/usr/doc/Cygwin/inetutils*.README" for more info.
The FreeBSD handbook: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html
Downloaded "4.3-install.iso" from ftp://ftp9.FreeBSD.org/pub/os/FreeBSD/releases/i386/ISO-IMAGES/ and cut a CD on phoebus (207.24.169.86) as root with:
cdrecord -v speed=2 dev=0,1,0 4.3-install.iso
(Created user on hagar with "/usr/sbin/useradd -u 1009 sford", then added "/opt/schily/bin" to PATH and "/opt/schily/man" to MANPATH.)
Installed devel system "thor" with mostly defaults for everything. When I create the "sford" account, I added it to the "wheel" group so that it has "su" capabilities.
Some doc:
Install RedHat as follows:
Then reboot, log in, "su" to root.
To enable apache and prepare it for DCReporter development:
mkdir /var/www/perl cd /etc for F in 3 4 5; do mv rc${F}.d/K15httpd rc${F}.d/S85httpd; done vi /etc/group <em>(add "dcrpt,sford" to end of "dcrpt" entry)</em> chgrp dcrpt `find /var/www -print` vi /etc/httpd/httpd.conf <em>(Add "PerlSendHeader On" to "<Location /perl>" after "PerlHandler". Also change all "AllowOverride None" to "AllowOverride All". Also set up "ServerAdmin" and "ServerName".)</em>
Good place for RFCs: http://www.faqs.org/rfcs/rfc-activeT.html
Protocol overhead byte counts (TCP/UDP/IP): http://sd.wareonearth.com/~phil/net/overhead/
Private networks (unrouted IP addresses) from http://www.faqs.org/rfcs/rfc1597.html
10.0.0.0 - 10.255.255.255 (class A network, or CIDR 10.0.0.0/8) 172.16.0.0 - 172.31.255.255 (16 class B networks, or CIDR 172.16.0.0/12) 192.168.0.0 - 192.168.255.255 (256 class C networks, or CIDR 192.168.0.0/16)
HTML 3.2 spec: http://www.w3.org/TR/REC-html32.html
Trademarks: ™=™ ™= ®=®
To include username/password in FTP urls: ftp://usr:psw@host/...
auto-refresh page:
|
Basic table:
|
To make a nice colored box with text:
|
To make a link that spawns a new window:
|
Indigo Perl is a binary build of Perl for Win32 with an integrated Apache web server configured for mod_perl. See http://www.indigostar.com/ for more info and the latest download.
To install it, perform the following steps:
old new ServerAdmin you@your.address ServerAdmin steve_ford@geeky-boy.com ... ServerName localhost ServerName 192.168.0.6 ... ScriptAlias /perl-bin/ "perl-bin/" ScriptAlias /perl/ "c:/indigo/perl/" PerlSendHeader On PerlSendHeader On <Location /perl-bin> <Location /perl>
Some useful doc:
Ftp to host1 and get the following files from the directory "/usr/local/sford.nobackup":
Digest-MD5-2.14.tar.gz libnet-1.0703.tar.gz MIME-Base64-2.12.tar.gz URI-1.15.tar.gz HTML-Tagset-3.03.tar.gz HTML-Parser-3.25.tar.gz libwww-perl-5.53.tar.gz mod_perl-1.26.tar.gz apache_1.3.20.tar.gz mod_perl_extras.tar.gz
The first seven regular perl packages. Unpack and install each of them in the order shown:
gunzip -c <PACKAGE.tar.gz | tar xvf - cd PACKAGE perl Makefile.PL make make test su <em>(enter root password)</em> make install exit <em>(exit root)</em> cd ..
Apache, mod_perl, and mod_perl_extras need to be done sort-of interleaved. First extract apache. Then build mod_perl according to "INSTALL.apaci":
gunzip -c <apache_1.3.20.tar.gz | tar xvf - gunzip -c <mod_perl-1.26.tar.gz | tar xvf - cd mod_perl-1.26 vi Makefile.PL <em>(change "(RM)" to "(RM_F)")</em> perl Makefile.PL APACHE_SRC=../apache_1.3.20/src DO_HTTPD=1 USE_APACI=1 PREP_HTTPD=1 EVERYTHING=1 make <em>(leave out "make test")</em> su <em>(enter root password)</em> make install exit <em>(exit root)</em> cd ..
Now finish apache:
cd apache_1.3.20 ./configure --prefix=/usr/local/apache --activate-module=src/modules/perl/libperl.a make su <em>(enter root password)</em> make install gunzip -c <../mod_perl_extras.tar.gz | (cd /usr/local/apache;tar xvf -) chown nobody /usr/local/apache/logs/cgi.log chgrp nobody /usr/local/apache/logs/cgi.log vi /usr/local/apache/conf/httpd.conf <em>(update "Port", "ServerAdmin", "ServerName")</em> <em>(go to end and add 'Include "conf/mod_perl.conf"')</em> /usr/local/apache/bin/apachectl start telnet localhost 80 GET /perl/sample <em>(should print output of sample mod_perl program)</em> exit <em>(exit root)</em> cd ..
Be sure to look in the "htdocs" and "cgi-bin" direcories and remove anything you don't want.
To password-secure the site (all passwords set to "sissors"):
su <em>(enter root password)</em> cd /usr/local/apache/ vi conf/httpd.conf <em>(change most "AllowOverride" lines to "AllowOverride All")</em> <em>(go to the end and add 'Include "conf/auth.conf"')</em> echo "samsclub: sford sam chw ginzburg jmp" >conf/group cp /dev/null conf/passwd for F in sford sam chw ginzburg jmp tst;do bin/htpasswd -b conf/passwd $F sissors;done
Then add ".htaccess" files in the various directories. Some examples:
echo "require valid-user" >htdocs/.htaccess echo "require group samsclub" >perl/.htaccess echo "require user sford" >cgi-bin/.htaccess
Note that given this setup, the "icons" directory is not protected.
Yes, I'll admit it, I STILL program perl like a C programmer. But I am getting better. This section is not just how to do C-isms in perl; it's also stuff I just haven't managed to memorize yet.
You don't need to use awk to do quick one-liners. Here's a one liner that makes a splits space-separated fields into multiple lines:
echo $LONGLINE | perl -nlae 'foreach (@F) {print;}'
(-n=Loop, -l=Chomp&PrintNl -a=AutoSplit -e=Src) Just remember that (unlike awk) the array of fields (@F) is zero-based, not one-based. You can also include "-Fx" where "x" is a delim character.
To deal with binary files, invert each byte:
open INP $ARGV[0] || die "open $ARGV[0]"; binmode(INP); binmode(STDOUT); my ($buf, $len); while ($len = read(INP, $buf, 2048)) { my @bytes = unpack("C*", $buf); foreach (@bytes) { $_ = ~ $_; } print pack("C*", @bytes); }
More random stuff:</p>
push(@a, $x) | splice(@a, $#a+1, 0, $x) |
pop(@a) | splice(@a, -1) |
unshift(@a, $x) | splice(@a, 0, 0, $x) |
shift(@a) | splice(@a, 0, 1) |
$a[3]=$x | splice(@a, 3, 1, $x) |
for ($test_string) { # switch with implicit assignment to $_ /abc/ && do { foo; last; }; /xyz/ && do { bar; last; }; do { # need "do" or else "last" just breaks bare block baz; last; }; # or could leave out the braces altogether } # switch $test_string
Note that the "last" statements don't break out of the "do" block but all the way out of the "for" block (see "break" above).
For non-strings it's a little more messy cuz there isn't a straight-forward way to test for non-string equality with the $_ and the operator implied. i.e. "$_ == 7 && do {"
Some bugzilla stuff:
$ mysql --user bugs bugs4 --password . . . show tables;
Note that adding --password causes it to prompt for password. You can also do --password='xyz' so that it doesn't prompt.
One of the tables is "bugs". To see the column names:
select distinct column_name from information_schema.columns where table_name = 'bugs' order by ordinal_position;
You can also put SQL code into a file and do:
source file;
So, you can do a non-interactive SQL this way:
$ mysql --user bugs bugs4 --password='xyz' --command='source file'
In the following examples, it uses the database "radius" that Andrew has on the Unix host "radium.csgcsg.net". Note that the "calls" table was built by running "dataagent.pl" on the file "radiusacct_debug.log".
<em>On radium:</em> $ <b>mysql -ureporter -pt3st -P3306 -hlocalhost -B -e'select * from calls' radius</b> <em>(print all records)</em> $ <b>mysql -ureporter -pt3st -P3306 -hlocalhost radius</b> <em>(interactive)</em> mysql> <b>SHOW DATABASES;</b> mysql> <b>USE radius;</b> <em>(optional since it's on cmd line)</em> mysql> <b>SHOW TABLES;</b> mysql> <b>SHOW TABLE STATUS;</b> mysql> <b>SHOW COLUMNS FROM calls;</b> mysql> <b>SELECT * FROM calls;</b> <em>(print all columns)</em> <em>MySQL doesn't support a transaction environment, so you must lock tables to ensure no other thread comes between a select and an update:</em> mysql> <b>LOCK TABLES trans READ, customer WRITE;</b> mysql> <b>SELECT SUM(value) FROM trans WHERE customer="fred";</b> mysql> <b>UPDATE customer SET total_value=sum_from_previous_statement WHERE customer="fred";</b> mysql> <b>UNLOCK TABLES;</b> <em>Here's a big one [multiple-users.sh]:</em> mysql> <b>create temporary table tmp (username varchar(80), nu int);</b> <em>A temporary table is in-memory and will be automatically deleted.</em> mysql> <b>insert into tmp select user_name, count(user_name) as nusers from calls group by user_name;</b> <em>The select statement selects 151 rows.</em> mysql> <b>select username, nu from tmp where nu > "1";</b> <em>Prints usernames that show up more than once</em> mysql> <b>drop table tmp;</b> <em>(Prolly not needed)</em> mysql> <b>quit</b> <em>(No semi-colon needed)</em> mysql> <b></b>
Finding the init.ora file:
<em>(On host3)</em> host3$ cd /space;find local u?? admin -name '*cad2*.ora' -print <em>(The first three are just symbolic links to the "real" files)</em> u01/app/oracle/product/8.0.5/dbs/configcad2.ora -> ... u01/app/oracle/product/8.0.5/dbs/initcad2.ora -> ... u01/app/oracle/product/8.0.5/dbs/initcad2_0.ora -> ... <em>(The next three ARE the "real" files)</em> <b>u01/app/oracle/admin/cad2/pfile/configcad2.ora</b> <b>u01/app/oracle/admin/cad2/pfile/initcad2.ora</b> u01/app/oracle/admin/cad2/pfile/initcad2_0.ora <em>(not used)</em> <em>(The next three are old)</em> admin/cad2/pfile/configcad2.ora admin/cad2/pfile/initcad2.ora admin/cad2/pfile/initcad2_0.ora <em>A useful log file:</em> <b>/space/u01/app/oracle/admin/cad2/bdump/alert_cad2.log</b> <em>(On zeus)</em> zeus$ echo $ORACLE_HOME /usr/local/oracle8/u01/app/oracle/product/8.0.5 zeus$ find /usr/local/oracle8 -name '*zs*.ora' -print <em>(The first six are symbolic links to the "real" files)</em> /usr/local/oracle8/u01/app/oracle/product/8.0.3/dbs/configzs.ora /usr/local/oracle8/u01/app/oracle/product/8.0.3/dbs/initzs.ora /usr/local/oracle8/u01/app/oracle/product/8.0.3/dbs/initzs_0.ora /usr/local/oracle8/u01/app/oracle/product/8.0.5/dbs/configzs.ora /usr/local/oracle8/u01/app/oracle/product/8.0.5/dbs/initzs.ora /usr/local/oracle8/u01/app/oracle/product/8.0.5/dbs/initzs_0.ora <em>(The next three ARE the "real" files)</em> /usr/local/oracle8/u01/app/oracle/admin/zs/pfile/configzs.ora /usr/local/oracle8/u01/app/oracle/admin/zs/pfile/initzs.ora /usr/local/oracle8/u01/app/oracle/admin/zs/pfile/initzs_0.ora
$ORACLE_HOME/bin/sqlplus -s pdcuser/pdcuser@cad2 set echo on; describe all_tables; select owner,table_name,tablespace_name from all_tables; describe dba_tablespaces; select * from dba_tablespaces; <em>(when a stored procedure has a error, get at it during the same session:)</em> describe user_errors; select line,position,text from user_errors order by sequence; <em>(To enable utl_file access:)</em> su - oracle vi /space/u01/app/oracle/admin/cad2/pfile/initcad2.ora <em>(Add "UTL_FILE_DIR = *")</em> <em>(Now need to restart Oracle)</em>
First, become root. Then:
su - oracle $ORACLE_HOME/bin/svrmgrl connect internal shutdown immediate startup quit
First, become root. Then:
su - oracle $ORACLE_HOME/bin/lsnrctl status start quit
cd $ORACLE_HOME/rdbms/admin sqlplus sys/change_on_install@zs @catproc
http://www.koders.com/ - searchable open source code.
The xadd instruction adds the source to the destination and copies the original destination value to source. For windows, it's safer to call InterlockedExchangeAdd().
long atomic_add(volatile long *dest, long src) { #if defined(_WIN32) return InterlockedExchangeAdd(dest, src); #elif defined(__GNUC__) && defined(HAVE_PENTIUM_PROCESSOR) unsigned long addr = (unsigned long)dest; asm("lock ; xadd %0 (%1)" : "+r"(src) : "r"(addr)); return src; #else long tmp; pthread_mutex_lock(&global_atomic_lock); tmp = *dest; *dest += src; pthread_mutex_unlock(&global_atomic_lock); return tmp; #endif } /* atomic_add */
IBM stuff on condition variables
Much of the info in this section came from an IBM page on condition variables.
A "condition predicate" is a general state that can be manipulated and tested. It can be arbitrarily complex (e.g. many variables being tested in complex ways), but the idea is that the act of testing the condition should not have side effects and it should result in a TRUE/FALSE result (either the condition is present or it is not). So let's define two fragments of code: MANIP_COND and TEST_COND.
The manipulation and testing of the condition predicate must be protected with a mutex. (The MANIP_COND and TEST_COND fragments do *not* include mutex operations.)
Note that signaling a condition is an "edge triggering" event - it wakes up any threads that might be waiting, but will not wake up a future wait. Hence the use algorithms below.
GLOBALS:
pthread_mutex_t cond1_lock; /* don't need PTHREAD_MUTEX_INITIALIZER, calling _init */ pthread_cond_t cond1_cond; /* don't need PTHREAD_COND_INITIALIZER, calling _init */ pthread_mutex_init(&cond_lock, NULL); pthread_cond_init(&cond1_cond, NULL); ... /* rest of program */ pthread_cond_destroy(&cond1_cond); pthread_mutex_destroy(&cond_lock, NULL); /* May need to do this: * while (pthread_cond_destroy(&cond1_cond) == EBUSY) { * pthread_cond_broadcast(&cond1_cond); * pthread_yield(); * } */
MANIPULATOR:
bool cond1_predicate; pthread_mutex_lock(&cond1_lock); MANIP_COND; cond1_predicate = TEST_COND; if (cond1_predicate) { pthread_cond_signal(&cond1_cond); /* or pthread_cond_broadcast(&cond1_cond); } pthread_mutex_unlock(&cond1_lock);
WAITER:
bool cond1_predicate; int res = 0; pthread_mutex_lock(&cond1_lock); cond1_predicate = TEST_COND; /* Need to loop because wait can return spuriously */ while (res == 0 && ! cond1_predicate) { res = pthread_cond_wait(&cond1_cond, &cond1_lock); cond1_predicate = TEST_COND; } ... /* Can do some MANIP_COND if want */ pthread_mutex_unlock(&cond1_lock); /* Or replace pthread_cond_wait with: * struct timespec timeout_tv; * timeout_tv->tv_sec = (wait_ms) / 1000; * timeout_tv->tv_nsec = ((wait_ms) mod 1000) * 1000000; * int res = pthread_cond_timedwait(&cond1_cond, &cond1_lock, &timeout_tv); * if (res == ETIMEDOUT) ... */
Windows Events
The "manualReset" indicates if it is a one-shot wakeup or a stateful wakeup. Either way, windows events *does* have memory.
See Example using Win events.</p>
http://www.cs.rochester.edu/u/scott/synchronization/pseudocode/queues.html
Two-lock concurrent queue. structure node_t {value: data type, next: pointer to node_t} structure queue_t {Head: pointer to node_t, Tail: pointer to node_t, H_lock: lock type, T_lock: lock type} initialize(Q: pointer to queue_t) node = new_node()// Allocate a free node node->next.ptr = NULL// Make it the only node in the linked list Q->Head = Q->Tail = node// Both Head and Tail point to it Q->H_lock = Q->T_lock = FREE// Locks are initially free enqueue(Q: pointer to queue_t, value: data type) node = new_node() // Allocate a new node from the free list node->value = value// Copy enqueued value into node node->next.ptr = NULL// Set next pointer of node to NULL lock(&Q->T_lock)// Acquire T_lock in order to access Tail Q->Tail->next = node// Link node at the end of the linked list Q->Tail = node// Swing Tail to node unlock(&Q->T_lock)// Release T_lock dequeue(Q: pointer to queue_t, pvalue: pointer to data type): boolean lock(&Q->H_lock) // Acquire H_lock in order to access Head node = Q->Head// Read Head new_head = node->next// Read next pointer if new_head == NULL// Is queue empty? unlock(&Q->H_lock)// Release H_lock before return return FALSE// Queue was empty endif *pvalue = new_head->value// Queue not empty. Read value before release Q->Head = new_head// Swing Head to next node unlock(&Q->H_lock)// Release H_lock free(node)// Free node return} TRUE// Queue was not empty, dequeue succeeded
See http://en.wikipedia.org/wiki/Dekker's_algorithm
Note that modern CPUs can re-order execution, requiring memory barriers, for which there doesn't appear to be a portable implementation. So this algorithm may not be applicable for user-mode code on multi-processor machines.
/* Mutex that only works for 2 CPUs. Does not require test-and-set */ #define PROC_A 0 #define PROC_B 1 int trying[2] = {0, 0}; int turn = PROC_A; void enter(int me) { int other = 1 - me; trying[me] = 1; while (trying[other]) { if (turn == other) { trying[me] = 0; while (turn == other) { } /* perhaps include a sleep */ trying[me] = 1; } } } /* enter */ void exit(int me) { int other = 1 - me; turn = other; trying[me] = 0; } /* exit */
See also http://www.sm.luth.se/csee/courses/smd/006/lectures/code/ http://www.cs.tcd.ie/Sotirios.Terzis/3BA3/L3/ and http://www.cs.wvu.edu/~jdm/classes/cs356/notes/mutex/ for various mutex algorithms.
Thanks to Karen Ford for sketching out the algorithm.
#include "pthread.h" typedef struct lock_struct { pthread_mutex_t read_lock, write_lock, read_mutex; int num_readers; } LOCK; void read_lock (LOCK *my_lock) { pthread_lock(&(my_lock->write_lock)); pthread_lock(&(my_lock->read_mutex)); if (my_lock->num_readers == 0) pthread_lock(&(my_lock->read_lock)); ++my_lock->num_readers; pthread_unlock(&(my_lock->read_mutex)); pthread_unlock(&(my_lock->write_lock)); } /* read_lock */ void read_unlock (LOCK *my_lock) { pthread_lock(&(my_lock->read_mutex)); if (my_lock->num_readers > 0) --my_lock->num_readers; if (my_lock->num_readers == 0) pthread_unlock(&(my_lock->read_lock)); pthread_unlock(&(my_lock->read_mutex)); } /* read_unlock */ void write_lock (LOCK *my_lock) { pthread_lock(&(my_lock->write_lock)); pthread_lock(&(my_lock->read_lock)); // num_readers should be zero at this point } /* write_lock */ void write_unlock (LOCK *my_lock) // num_readers should still be zero at this point pthread_unlock(&(my_lock->read_lock)); pthread_unlock(&(my_lock->write_lock)); } /* write_lock */
Electric fence: http://duma.sourceforge.net/ For windows, see http://users.softlab.ece.ntua.gr/~ttsiod/HeapCheck.html
Valgrind: http://valgrind.org/ (pre-installed on Linix)
Here are the most useful gdb commands:
Here are the most useful dbx -I src_path comands:
Here is the output of the dbx "commands" command: sford dbx commands
Electric fence for Windows: http://users.softlab.ece.ntua.gr/~ttsiod/HeapCheck.html
When setting up a new box, you can increase performance (especially VNC performance) by turning off various effects. Right-click the desktop, select properties, click the "Appearance" tab, click "Effects...", uncheck "Use the following transition effect" and "show shadows under menus".
If you get outlook-style attachments (winmail.dat), you can decode them with http://tud.at/php/tnef/. Or download the "fentun" program from http://www.fentun.com/. To use it, extract the "winmail.dat" file and run the program from a dos prompt giving it the name of the "winmail.dat" file. (If that site goes away, I've got an archive copy here.)
Windows WSA error codes: http://www.sockets.com/err_lst1.htm
Register "Object Linking and Embedded (OLE) controls such as DLL or OCX (ActieX controls):
regsvr32 \dir\file.dll
Places to check for auto-run software:
- Registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run - Startup folders (global and user) - NT service
Here's a good place for finding out which processes are necessary: http://www.liutilities.com/products/wintaskspro/processlibrary/ which appears to be very similar to http://www.processlibrary.com/
Manipulating registry from dos prompt / batch file:
rem export key (exports all values) regedit /E c:\x.reg "HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Directories" rem manipulate file rem re-import (will prompt twice) regedit c:\x.ref
Some common DOS junk:
IF NOT x%1==x%BLAH% GOTO foo IF NOT EXIST %FNAME% ECHO %FNAME% not exist :foo
Overly slow-moving DOS tutorial: http://www.allenware.com/icsw/icswidx.htm
More dos stuff: http://www.robvanderwoude.com/robmain.html
Dos reference material: http://www.ss64.com/nt/
To run a program that the dos prompt "can't find", use the start command. For example, "msinfo32" returns "not recognized" whereas "start msinfo32" works.
sshd for windows: http://www.realvnc.com/pipermail/vnc-list/1999-March/005430.html or if the system already has cygwin: http://tech.erdelynet.com/cygwin-sshd.html (You might want to set the service to manual startup.)
Hosts file:
To get info about the system (processor speed, memory, etc), enter "start msinfo32".
To force a W2K/XP system to bluescreen:
You can force Windows 2000 and XP to display the blue screen of death. Hopefully, the only reason to do this is that you'll never see it otherwise! In the Registry key HKEY_LOCAL_MACHINE\System\ CurrentControlSet\Services\i8042prt\Parameters, find or create a DWORD value named CrashOnCtrlScroll. Double-click on the value and set its data to 1. Restart your computer. Now you can cause a crash by holding the right-hand Ctrl key and pressing the Scroll Lock key twice. Dirk A. D. Smith Actually, a valid reason to crash your computer deliberately is to test your recovery options. Windows 2000 and XP can be configured so that in the rare event of a crash, a memory dump will be saved for debugging purposes and your system will restart automatically. If your system needs maximum uptime, it behooves you to verify how well it recovers from a crash. First, make sure the recovery configuration is correct. Right-click on My Computer and choose Properties, then click on the Advanced tab. If you are running Windows XP, click on the Settings button in the Startup and Recovery pane. If you're running Win 2000, click on the button titled Startup and Recovery. In the System Failure pane you'll generally want all three of the following options checked: Write an event to the system log, Send an administrative alert, and Automatically restart. If you choose the 64KB Small Memory Dump, each occurrence is written separately to the folder specified. The Kernel Memory Dump is larger, and a Complete Memory Dump requires that you have a paging file large enough to hold all physical RAM plus 1MB; this is the largest option. By default, the two larger options are written to the file Memory.dmp in the Windows folder, with each occurrence overwriting the previous. Once you get the settings as you want them, close any open programs and use the special keystroke to crash the system. You can verify that the desired memory dump is written and check how long it takes to restart after a crash.
http://www.pcmag.com/article2/0,4149,1213622,00.asp
To force a system to boot into safe mode, hit "F8" during the bios initialization (before the first windows graphic screen).
To get a bitmap image of the whole screen, PrtSc (or Print Screen) makes a copy in the windows clipboard (cut buffer) which can then be pasted into Word or whatever. Or Alt+PrtSc will copy only the currently active window in.
In 95/98, "winipcfg" is used to release/renew dhcp. In 2K/NT it is a dos cmd "ipconfig".
To see the version and service pack level, "winver".
In Win2k, there are two levels of start menu. The "all users" is under:
C:\Documents and Settings\All Users.W2K\Start Menu
For the DCServer development laptop, the administrator start menu is under:
C:\Documents and Settings\Administrator.JPENNINGTON-L2\Start Menu
Microsoft MSDN:
Here's an excellent WinSock resource:
Applicable RFCs:
To snoop (skipping the udp header):
snoop -x 42 host1 and udp
RADIUS PACKET: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Code | Identifier | Len (incl Code, Id, Len) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Authenticator (16 bytes) | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Attributes ... +-+-+-+-+-+-+-+-+-+-+-+-+- ATTRIBUTES: 0 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- | Type | Length | Value ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Access-request - 128 bit random number with geographic and temporal uniqueness. Shared secret is appended with authenticator to generate an md5 hash which is xor'ed with password.
Access-response - RespAuth = MD5(RespCode+ReqID+RespLen+ReqAuth+RespAttribs+Secret)
Accounting-request - ReqAuth = MD5(ReqCode+ReqID+ReqLen+16*0x00+ReqAttribs+Secret)
Accounting-response - RespAuth = MD5(RespCode+ReqID+RespLen+ReqAuth+RespAttribs+Secret)
Rad codes:
AUTH_REQ = 01 AUTH_RSP = 02 AUTH_REJ = 03 ACCT_REQ = 04 ACCT_RSP = 05 |
|
Attribute codes:
USERNAME = 01 USER_PASSWORD = 02 CHAP_PASSWORD = 03 NAS_IP_ADDR = 04 NAS_PORT = 05 SERVICE_TYPE = 06 FRAMED_PROTOCOL = 07 FRAMED_IP_ADDR = 08 FRAMED_IP_NETMASK = 09 FRAMED_IP_ROUTING = 0a FILTER_ID = 0b FRAMED_MTU = 0c FRAMED_COMPRESSION = 0d LOGIN_IP_HOST = 0e LOGIN_SERVICE = 0f LOGIN_TCP_PORT = 10 REPLY_MESSAGE = 12 |
|
|
For attribute ATTR_VENDOR_SPECIFIC, valid OID codes:
$USR_ORGANIZATION_ID = 000001ad |
USR-specific attributes:
$USR_ATTR_VPN_ID = 00009006 $USR_ATTR_VPN_NAME = 00009007 $USR_ATTR_VPN_NEIGHBOR = 00009008 $USR_ATTR_TUNNEL_AUTHENTICATOR = 0000900b $USR_ATTR_PACKET_INDEX = 0000900c |
|
To get the 1.3 version of JRE for Windows: http://java.sun.com/j2se/1.3/jre/download-windows.html
Host1 and Host2 changed the network they resided on. I had to change the following files:
In addition, on zeus I had to change:
I wanted to be able to rsh from host1 to host2.
On host1 and host2, I edited "/etc/services" and commented out the existing "shell" entry and made a new one:
#shell 514/tcp cmd # no passwords used shell 12000/tcp cmd # no passwords used
On zeus, I edited "/etc/inetd.conf" and un-commented the "shell" line:
shell stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.rshd
Then, (still zeus) kill -HUP inetd.
Finally, create a ".rhosts" file.
If you want have some control over the environment of the remote process, you should use the "bash" shell on the remote machine. Be sure that bash is in the "/etc/shells" file. Then create a ".bashrc" file containing your environment definition. Note: a login shell executes ".profile" instead of ".bashrc". Therefore, you should explicitly source ".bashrc" inside your ".profile".
When using dbx (or any of the other Sun "workshop" stuff) the license manager has to be running. For some reason, it tends to crash over the weekends. To restart it, log in as root on zeus. Then:
cd /etc/init.d ./lic_mgr stop ./lic_mgr start
FYI - the licence manager executable is "/etc/opt/licenses/lmgrd.ste". Also, the files "/etc/init.d/lic_mgr" and "/etc/rc2.d/S85lmgrd" are the same physical file (i.e. are hard-linked).
This is an unrouted network:
ifconfig hme0:1 inet 192.168.0.1 up netmask 0xffffff00 broadcast 192.168.0.255
Then need to create "/etc/hostname.hme0:1" containing a name (e.g. "host1_1"). Then add an entry to "/etc/hosts" (e.g. "209.219.112.2 host1_1").
This outlines what I did for the udp_tool account. Commands preceided with "r" need root access.
nawk </etc/passwd -F: "{if(\$3<9999)print \$3}"|sort -n|tail rsh zeus 'nawk </etc/passwd -F: "{if(\$3<9999) print \$3}"'|sort -n|tail rsh host3 'nawk </etc/passwd -F: "{if(\$3<9999)print \$3}"'|sort -n|tail <em>(for each of host1, host2, and host3, do:)</em> r vi /etc/passwd udp_tool:x:1015:10:udp_tool testing:/export/home/udp_tool:/bin/ksh r vi /etc/shadow udp_tool:::::::: passwd udp_tool H=/usr/home <em>(zeus: "H=/usr/newhome", vaisya "H=/space")</em> mkdir $H/udp_tool chown udp_tool $H/udp_tool chgrp staff $H/udp_tool ln -s $H/udp_tool /export/home/udp_tool /usr/local/bin/ssh -l udp_tool localhost echo host1 >.rhosts <em>(host2 and host3 only)</em> exit
p4 files sub.c <em>(To get current version)</em> p4 diff2 sub.c#19 sub.c#20
See http://www.cvshome.org/docs/manual/index.html for a cvs manual.
cvs history -ca filename | sort
cvs tag Rel_1_19b - can supply "-b" to make it a branch tag. But if do, then should typically follow with "cvs update -rRel_1_19b" so that current workspace is "sticky". See http://www.cvshome.org/docs/manual/index.html for a cvs manual.
Getting "History"
Forget the cvs history command - I still don't know what the heck it is for. Do a:
cvs log file
Running CVS Remotely
There is probably an easier way to do this, but this is the way I got working first.
Change your zeus account to use the shell "/usr/local/bin/bash". Then change your ".kshrc" to ".bashrc". Move your environment definitions out of your ".profile" and into your ".bashrc". In the ".profile", add a line to source the ".bashrc" (for some reason, bash doesn't automatically run it for the login shell). Create a file ".rhosts" file.
On the remote system, set your CVSROOT environment variable to be: ":ext:<USERNAME>@zeus:/usr/local/cvsroot" where "<USERNAME>" is your user name on zeus.
As a test, from the remote system enter:
rsh zeus set | egrep "^PATH"
It should contain "/usr/local/bin".
Creating a project/module
This is taken from http://www.cvshome.org/docs/manual/cvs_3.html#SEC40
If the files you want to install in CVS reside in `wdir', and you want them to appear in the repository as `$CVSROOT/yoyodyne/rdir', you can do this:
$ cd wdir $ cvs import -m "Imported sources" tools/udp_tool init_vtag init_rtag $ cd .. $ cvs checkout CVSROOT/modules $ cd CVSROOT $ vi modules $ cvs commit -m "added udp_tool" modules $ cd .. $ cvs release -d CVSROOT
Unless you supply a log message with the `-m' flag, CVS starts an editor and prompts for a message. The string `init_vtag' is a vendor tag, and `init_rtag' is a release tag. They may fill no purpose in this context, but since CVS requires them they must be present.
Sierra Wireless Cell Phone Modem
Before plugging in modem, install SierraWatcher package and bring it up.
Sierra Wireless Watcher -> Preferences -> Profiles Account: WAP@CINGULAR.COM Password: CINGULAR1 APN: WAP.CINGULAR
Plugging in the modem automatically brings up network preferences.
Configuration: Default Telephone Number: *99***1# Account Name: WAP@CINGULAR.COM Password: CINGULAR1
Become a Wireless Router
Wifi icon should now turn into an upwards-pointing arrow.
Thanks to http://support.microsoft.com/kb/189326 which got me started. See also http://tools.ietf.org/html/rfc3501
telnet imap.suso.com 143 ? LOGIN sford psw ? LIST "" "*" ? SELECT folder ? FETCH msg_num ALL ? FETCH msg_num BODY ? LOGOUT
Lines start with a tag, end with CRLF.
To edit a page, first display it:
To rebuild TOC:
To add a section:
Compiler barrier for gcc:
__inline static void gcc_barrier() { asm volatile ("" ::: "memory"); }
Memory Ordering in Modern Microprocessors, part 1 and part 2 - good articles about memory barriers across various CPU types.
Here's some more good info: https://www.kernel.org/doc/Documentation/memory-barriers.txt
A good cache line article: http://igoro.com/archive/gallery-of-processor-cache-effects/
From http://www.owchallie.com/systems/cache-itanium2.php:
The [Intel Itanium 2] level 3 unified cache is either 1.5MB or 3MB in size and can be accessed at core speed, providing 32GB/cycle. It is single ported and fully pipelined. The cache is 12-way set associative with a 128 byte line size.