22 November 2012
23 October 2012
Shift
Wonderful. Random javascript. Note I added //<!-- and //--> to get Blogger to stop escaping those pesky less-than and greater-than signs.
21 October 2012
Functional Groups
Ok so I made this and then left it somewhere. Hmm.
Functional group Molecule name Hydroxyl -O-H HO Alcohol Carbonyl H CO / (Aldehyde) -C \ O (O) | | (Ketone) -(C)- O O Carboxyl // // COOH -C -C (ionized) Carboxylic acid \ \ O-H O+ H H Amino / | NH_3 -N -(N+)-H (ionized) Amine \ | H H Sulfhydryl SH2 -S-H Thiol O Phosphate || O_3P -O-P-(O-) Organic phosphate | (O-)
More Vim Stash
"System-wide gvimrc":
Core insert commands:
Switch to directory of currently edited file
Occasionally useful
set backspace=indent,eol,start syntax onBasic:
S 'sc' 'smd' S 'hls' 'is' C 'ic' 'scs' L 'list' 'lcs' I 'ai' 'bs' N 'nu' 'ru' T 'ts' 'sw' 'lbr' 'so' | set showcmd set showmode set hlsearch set incsearch set ignorecase set smartcase set list set listchars=tab:›\ ,trail:·,extends:▶,precedes:◀ set autoindent set backspace=indent,eol,start filetype plugin indent on set number set ruler set tabstop=4 set shiftwidth=4 color torte set linebreak " note: canceled by list set scrolloff=2 |
Core insert commands:
^H
deletes character (backwards), ^W
deletes word (backwards), ^O
lets you do one normal command.^C
will also get you out of insert mode, just without abbreviations. Wow, I should try using abbreviations.Switch to directory of currently edited file
command Cwd cd %:p:h
Occasionally useful
function Hex(n) return printf("%x", n) endfunction
function Bin(n) if a:n == 0 return "0" elseif a:n == 1 return "1" else return Bin(a:n/2) . (a:n%2) endfunction
11 May 2012
Notes on Die Kutschfahrt zur Teufelsburg
Darn, I lost the instruction book and the only way I can find the rules (for the classic version, not the translated and modified Castle of the Devil) online, apparently, is by translating the Portuguese translation on their website back into English.
Random corner cases so I do not have to do this again:
Random corner cases so I do not have to do this again:
- A Secret Bag cannot be traded for a Secret Bag. (But I knew that already)
- The person who declares victory needs at least one of the keys or goblets that his association wins with. (I have a feeling our group is just going to ignore this)
- All players who the person names in declaring victory need at least one of the keys or goblets as well. (Ditto)
- The card limit is 8 cards for 3 players, 6 cards for 4 players, 5 cards for more. When somebody has more cards than the limit (not equal), he must give a card to a player whose cards haven't reached the limit. (This is an amendment on the official website because otherwise two players could swap all their cards.)
- If the Diplomat succeeds in forcing a trade, he can still have his normal turn action. If he fails, his turn ends. This trade does activate special abilities of objects.
- The Doctor must be the attacker or defender to use his ability.
- The Priest must not be the attacker or defender to use his ability. (Possible glitch of translation because it says "did not must")
- The Hypnotist has to use his ability after declarations and before special objects.
23 March 2012
Floating-point
Single-precision: sign 1b, exponent 8b, fraction 23+1b implied (= 6 ~ 9 decimal sigfigs)
Double-precision: sign 1b, exponent 11b, fraction 52+1b implied (= 15 ~ 17 decimal sigfigs)
Special cases:
Double-precision: sign 1b, exponent 11b, fraction 52+1b implied (= 15 ~ 17 decimal sigfigs)
Special cases:
- Exponent = 0
- fraction = 0: (+/-) zero
- fraction != 0: "subnormal" number with implied bit set to 0 instead
- Exponent = (FF or 3FF, maximum value in allocated bits)
- fraction = 0: (+/-) infinity
- fraction != 0: NaN (sign ignored)
- top explicit fraction bit = 1: "quiet NaN"
- top explicit fraction bit = 0 (and rest != 0): "signaling NaN"
18 March 2012
Cross-Platform Regular Expressions
There used to be a lot of blathering about regexes but I think nobody would read them anyway and I want a reference. Also it's incomplete and there is no logic whatsoever to which parts I chose. This is why I wanted colorful code tags.
The patterns in this post are the regex string, which may need to be escaped further in code. Perl's regexes are the base of many other ones, but tiny differences abound.
References: perlre; java.util.Pattern; Python re; vimdoc *pattern*;
As expected, normal alphanumeric characters are regexes that match themselves and only themselves.
Quantifiers (Vim calles them "multis") take the previous piece of regex and allow it to match repeatedly some number of times (possibly none).
Python: {,10} is allowed (not in perl!)
Vim:
They are tightly bounding, so
The above quantifiers are greedy; they try to match as much as possible. At the end of any of them, add an extra
Python, Vim: no possessives.
Vim: No adding
Each can be capitalized to match any character not in the class instead. Note that they might include foreign Unicode characters with the same properties; check your language.
As should be expected Vim has different notation for every single one of these:
For other assertions, put one of
Explanation: Zero-widths match a null substring, but only if the part after/before that null substring matches/does not match the pattern.
Independent group: It will look for the "first" way this pattern matches and only match that. Same idea as possessive quantifiers.
Here's a Vim string for a standalone URL from the random rst syntax I'm staring at. Admire.
A weak Vim substitute command for detecting raw ampersands in XML, for some reason.
Also. Infamous RFC regex
The patterns in this post are the regex string, which may need to be escaped further in code. Perl's regexes are the base of many other ones, but tiny differences abound.
References: perlre; java.util.Pattern; Python re; vimdoc *pattern*;
As expected, normal alphanumeric characters are regexes that match themselves and only themselves.
^
matches start of string.$
matches end of string..
matches any character except newline.|
matchers the OR of two regexes (Vim: requires escaping as \|
.)(pattern)
groups a regex (Vim: requires escaping as \(pattern\)
.)[chars]
matches any of a set of characters, e.g. c or h or a or r or s.Quantifiers
hee hee, h3 tagsQuantifiers (Vim calles them "multis") take the previous piece of regex and allow it to match repeatedly some number of times (possibly none).
*
: 0 or more+
: 1 or more?
: 0 or 1{5}
: 5{5,}
: 5 or more{5,10}
: 5 to 10 inclusivePython: {,10} is allowed (not in perl!)
Vim:
\+
, \?
, and \{
must be escaped for the above meaning (under normal 'magic'
setting). You can escape or not escape the }
. \=
is a synonym for \?
, as a second question mark would delimit the offset in backward search. \{}
or \{,5}
is allowed.They are tightly bounding, so
42+
matches strings like 42222, not 42424242.The above quantifiers are greedy; they try to match as much as possible. At the end of any of them, add an extra
?
and it becomes reluctant (Java tutorial term), trying to match as little as possible. Alternatively, adding a +
makes the quantifier possessive; it matches everything it can and no less, even if it takes up something the rest of the pattern might need.Python, Vim: no possessives.
Vim: No adding
?
s. Instead only bracket quantifiers can be made reluctant, by adding a dash, like \{-5,10}
. Character Classes
As we've seen[aeiou]
matches one of the characters between the square brackets. Then there are a variety of commonly-occurring character-sets that people want to match. Some very common ones:\w
= "word" character (alphanumeric, underscore)\d
= digit\s
= whitespace (space, tab, newlines)\h
= horizontal whitespaceEach can be capitalized to match any character not in the class instead. Note that they might include foreign Unicode characters with the same properties; check your language.
Weird Stuff
X is a regex.(?#X)
: nothing, merely a comment (not in Java)(?:X)
: X, non-capturing(?=X)
: X, via zero-width positive lookahead(?!X)
: X, via zero-width negative lookahead(?<=X)
: X, via zero-width positive lookbehind(?<!X)
: X, via zero-width negative lookbehind(?>X)
: X, as an independent, non-capturing groupAs should be expected Vim has different notation for every single one of these:
\%(X\)
: X, non-capturingFor other assertions, put one of
\@=
, \@!
, \@<=
, \@<!
, \@>
after a regex, probably a group.Explanation: Zero-widths match a null substring, but only if the part after/before that null substring matches/does not match the pattern.
Independent group: It will look for the "first" way this pattern matches and only match that. Same idea as possessive quantifiers.
Here's a Vim string for a standalone URL from the random rst syntax I'm staring at. Admire.
"\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]"
A weak Vim substitute command for detecting raw ampersands in XML, for some reason.
:%s/&\(amp;\|gt;\|lt;\|quot;\|#\)\@!/\&/gc
Also. Infamous RFC regex
17 March 2012
Chapter 23
I happen to feel like this is a good way to, I don't know, let off steam and deal with reality. It's probably just me.
1
1
- (dermal tissue)
- (vascular tissue)
- (ground tissue)
- epidermal cell
- (trichome)
- (xylem) [nonlinear syllabus; from Chapter 22]
- (tracheid) [ditto]
- (phloem) [ditto]
- vessel element
- sieve tube element
- companion cell
- parenchyma
- collenchyma
- sclerenchyma
- meristem
- meristematic tissue
- apical meristem
- differentiation
- taproot
- fibrous root
- (epidermis)
- root hair
- cortex
- endodermis
- vascular cylinder
- root cap
- Casparian strip
- node
- internode
- bud
- vascular bundle
- pith
- primary growth
- secondary growth
- vascular cambium
- cork cambium
- heartwood
- sapwood
- bark
- blade
- petiole
- mesophyll
- palisade mesophyll
- spongy mesophyll
- stoma
- guard cell
- transpiration
- adhesion
- capillary action
- pressure-flow hypothesis
- (transpirational pull)
04 March 2012
Accent Marks
cliché
déjà vu
doppelgänger
naïve
Pokémon
touché
Of course substituting the unmarked letters will annoy only the grammar Nazis among us, but...
déjà vu
doppelgänger
naïve
Pokémon
touché
Of course substituting the unmarked letters will annoy only the grammar Nazis among us, but...
24 February 2012
Current Events News Sources
Wait, why am I posting here again!?!?
I really hate it when I find blogs that say "this blog has moved to some other place" and a bunch of dead content. On the other hand I don't want to just delete this subdomain (just in case), and I like having colored
Today's reference doesn't have
A.
I really hate it when I find blogs that say "this blog has moved to some other place" and a bunch of dead content. On the other hand I don't want to just delete this subdomain (just in case), and I like having colored
<code>
tags for when they're needed a lot. Therefore I will now start stashing random things like reference material or code snippets here. Unsubscribing might be a good idea.Today's reference doesn't have
<code>
tags, however. I hope nobody thinks this is a link farm.A.
- The Washington Post
- The New York Times
- The Wall Street Journal
- The Christian Science Monitor
- The Globe and Mail (Canada)
- The Guardian (UK)
- Le Monde (FR)
- The People's Daily (CH)
- Asahi Shimbun (JP)
- Al-Jazeera
- CBC (Canada Broadcasting Corporation)
- BBC
- Reuters (note: "inclusive")
- The Huffington Post
- Democracy Now
- In These Times
- Indymedia.org
- The Nation
- OneWorld Online
- Truthout
- Institute for Public Accuracy
- Project Censored
- The Multinational Monitor
19 February 2012
03 January 2012
Subscribe to:
Posts (Atom)