Skip to content

Latest commit

 

History

History
700 lines (559 loc) · 25.2 KB

plan

File metadata and controls

700 lines (559 loc) · 25.2 KB

.plan

Reading is forgetting

Knowledge, wisdom even, lies in depth, not extension.

Bitwise Gotcha

I’ve been working on porting some bitwise logic from Java to Python and it’s been as awful as that sentence sounds.

The main gotcha that I’ve run into has something to do with the fact that an int in Java is 32-bits so the logical NOT of an integer is different in Python vs Java.

So in python you get:

>>> bin(~0x000000ff)
'-0b100000000'

Whereas with java:

public class BitWise {
    public static void main(String[] args) {
        System.out.format("%s\n", Integer.toBinaryString(~0x000000ff));  // Prints: 11111111111111111111111100000000
    }
}

I ran into a problem because I was trying to XOR the output of a NOT which, obviously, comes out differently if you have different expecations what comes from NOT, i.e.:

assert(0b11111111111111111111111100000000 != -0b100000000)

The way around this for me, was to AND the NOT output with 0xffffffff. There are probably some weird edge-cases here ¯\_(ツ)_/¯.

Dumb git ref tricks

I’m always learning and losing dumb git tricks. Here are a few I might lose if I don’t keep them someplace:

Store a random, named blob in a repo

In this case it’s a GPG key

wget https://tylercipriani.com/018FAC02.asc
export obj=$(git hash-object -w --stdin < 018FAC02.asc)
git tag tyler-cipriani-gpg-key "$obj"
rm 018FAC02.asc
git cat-file -p $(git show-ref -s tyler-cipriani-gpg-key)
git show tyler-cipriani-gpg-key

Create a local symbolic reference to some reference

Like that gpg key tag, for instance

git symbolic-ref GPG_KEY refs/tags/tyler-cipriani-gpg-key
git show GPG_KEY

Create a whole new kind of ref, to track something and share it around

Could even store the gpg keys of lots of folks

wget https://tylercipriani.com/018FAC02.asc
export obj=$(git hash-object -w --stdin < 018FAC02.asc)
git update-ref refs/keys/tyler "$obj"
wget https://uniontownlabs.org/toddtreece.gpg.txt
export toddgpg=$(git hash-object -w --stdin < toddtreece.gpg.txt)
git update-ref refs/keys/todd "$toddgpg"
rm 018FAC02.asc toddtreece.gpg.txt
git show refs/keys/todd
git show refs/keys/tyler

You can even push them to a remote (github even) and fetch them back down on the other side:

git push origin refs/keys/*:refs/keys/*
git clone [repo]
git fetch origin refs/keys/*:refs/keys/*
git show refs/keys/tyler

Former Plan Files

In ancient days, on the computer networks of the Sumerians and Hittites, people kept .plan files as a way to disseminate useful and/or amusing information.

Dave Loffredo

Stoner

Deep in him, beneath his memory, was the knowledge of hardship and hunger and endurance and pain. Though he seldom thought of his early years on the Booneville farm, there was always near his consciousness the blood knowledge of his inheriteance, give him by forefathers whose lives were obscure and hard and stoical and whose common ethic was to present to an oppressive world faces that were expressionless and hard and bleak

– John Williams, Stoner

What I learned about email addresses today

I burrowed into RFC 5322’s Address Spec for a long time today. This resulted in a fun side-trip into Augmented BNF for Syntax Specifications: ABNF.

Email addresses break down to their Core Rules like this:

addr-spec       =   local-part "@" domain

addr-spec       =   dot-atom / quoted-string / obs-local-part
                    @
                    dot-atom / domain-literal / obs-domain

addr-spec       =   [CFWS] dot-atom-text [CFWS] / [CFWS]  DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS] / word *("." word)
                    @
                    [CFWS] dot-atom-text [CFWS] / [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS] /  atom *("." atom)

addr-spec       =   [(1*([FWS] comment) [FWS]) / FWS] 1*atext *("." 1*atext) [(1*([FWS] comment) [FWS]) / FWS] /
                    [(1*([FWS] comment) [FWS]) / FWS] DQUOTE *([([*WSP CRLF] 1*WSP) /  obs-FWS] qtext / quoted-pair) [([*WSP CRLF] 1*WSP) /  obs-FWS] DQUOTE [(1*([FWS] comment) [FWS]) / FWS] /
                    (atom / quoted-string) *("." (atom / quoted-string))
                    @
                    ...
                    /me dies

The density of local-part "@" domain weighs on me.

What was impressed upon me is how viscous all communication is: a means to deliever a message becomes a dense message of its own.

A valid domain is:

atext           =   ALPHA / DIGIT /    ; Printable US-ASCII
                    "!" / "#" /        ;  characters not including
                    "$" / "%" /        ;  specials.  Used for atoms.
                    "&" / "'" /
                    "*" / "+" /
                    "-" / "/" /
                    "=" / "?" /
                    "^" / "_" /
                    "`" / "{" /
                    "|" / "}" /
                    "~"

dtext           =   %d33-90 /          ; Printable US-ASCII
                    %d94-126 /         ;  characters not including
                    obs-dtext          ;  "[", "]", or "\"

domain          =  dot-atom / domain-literal / obs-domain

domain          =  ([CFWS] dot-atom-text [CFWS]) /                 ; dot-atom
                   ([CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]) /  ; domain-literal
                   (atom *("." atom))                              ; obs-domain

domain          =  ([CFWS] 1*atext *("." 1*atext) [CFWS]) /                   ; dot-atom
                   ([CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]) /             ; domain-literal
                   (([CFWS] 1*atext [CFWS]) *("." ([CFWS] 1*atext [CFWS])))   ; obs-domain

If we get rid of the Content Folding White Space which has a lot of rules and seems to be everywhere and is a context-free grammar we get something like:

(?:(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+[a-z0-9.!#$%&'*+\/=?^_`{|}~-]*)|(?:\[(?:[\x21-\x5A]|[\x5E-\x7E]|\[\\\])\]))

Org-mode to publish a site

A Manifesto of sorts

This single org-mode file is a blog. The org-mode file in which I am writing this text is filled with material that either isn’t substantive or focused enough to be published on my normal blog.

This material should be less ephemeral than things on a wiki (e.g. The movies section, the RFCs section, the Wikipedia pages section should be moved the Wiki).

I tend to experiment more with format in this file than in my notes directory (which I keep using Deft and org-mode) which means I learn more org-mode and that is a Good Thing™.

Some inspiration

Making a real-live multi-page cool-looking blog out of an org-mode file isn’t impossible.

Other org-related things

Can I just say: org-babel looks awesome as fuck.

A literate programming environment that can be used to configure a lisp-machine.

To paraphrase one of the authors below: that’ll earn you a lot of nerd merit- badges. I should maybe consider moving my Linux Tips repo over to this. Also, I should move my repos off of github and onto something self-hosted :( Too. Many. Projects. Le. Sigh.

How I generated this page

This is a weird, psuedo literate way of updating this file on the squiggle.city site.

First I ssh into squiggle using a src block with a :session identifier. The actual code in the org file can be seen on github.

For what it’s worth, I am executing this file to generate this HTML.

ssh squiggle

I can make sure I’m on the server, by checking the hostname, again, in the same :session. One important note that it took a while to figure out: I have to use the :exports both argument for the source block to show the results in the HTML output.

hostname
squiggle.city

I Have a file that exists as a local hack in my dotfiles on squiggle.city server, but don’t take my word for it:

file "/home/thcipriani/bin/squigglegen"
/home/thcipriani/bin/squigglegen: C source, ASCII text

Now, locally, without using the :session. I can save and commit this file to my .dotfiles repo:

/usr/bin/git -C /home/tyler/.dotfiles add plan
/usr/bin/git -C /home/tyler/.dotfiles commit -m '.plan spelling fixes'
/usr/bin/git -C /home/tyler/.dotfiles push
[master 2655be0] Add plan from org-mode
 1 file changed, 30 insertions(+), 18 deletions(-)

Then, back on my remote session, I can pull this code down, and regenerate my page using the squigglegen command.

/home/thcipriani/bin/squigglegen
First, rewinding head to replay your work on top of it...
Applying: [LOCAL HACK] Generate my squiggle city file :)
Applying: [LOCAL HACK] Emacs publish squigglegen
Updating

Typographically Perilous

“rock ‘n’ roll 7”s from the ’80s”

Thanksgiving vocabulary

Variadic Function – a function of indefinite airity. Considered complimentary to the apply function which is central to languages derived from lambda calculus.

Use in ES2015:

var printAwards = function(...places) {
    for (var place of places) {
        console.log(place);
    }
}

Bitwise shifts are like dividing by 2

Never thought about it:

  • x >> 2 == x / 2
  • x << 2 == x * 2

RFCs I have known and loved

“Finding RFCs for a particular topic is an art.”

Good ‘n’s

Markdown related

XSS String

”;!–”<XSS>=&{()}

Two quotes I saw and liked

I Didn’t particuarly enjoy this talk, but this quote was good:

Good judgment comes from experience, and experience comes from bad judgment. So if things aren’t going well, it probably means you’re learning a lot and things will go better later.

Randy Pausch Time Management https://youtu.be/oTugjssqOT0

Security at the expense of usability comes at the expense of security.

AviD http://security.stackexchange.com/questions/6095/xkcd-936-short-complex-password-or-long-dictionary-passphrase/6116#6116

RSA

The Magic Words are Squeamish Ossifrage

Taylor Swift for the Brave and True

You held your head like a hero On a history book page It was the end of a decade But the start of an age

  • Taylor Swift, Voice of Our Age

Gall’s Law

A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system.

– John Gall (Systemantics: How Systems Really Work and How They Fail.)

A recent Amazon.com order about which I feel a certain joy

Hardware

Hardware I have:

Hardware I think about:

Surprising things found in the 85 tabs open on my phone

  1. Solar Calculation Details http://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html
  2. Diceware passphrase http://world.std.com/~reinhold/diceware.html
  3. Receiving NOAA Weather Satellite Images http://www.rtl-sdr.com/rtl-sdr-tutorial-receiving-noaa-weather-satellite-images/
  4. George Washington’s Rules of Civility and Decent Behavior: in Company and Conversation https://archive.org/stream/georgewashington00unse/georgewashington00unse_djvu.txt
  5. Catchup http://boardgamegeek.com/boardgame/68199/catchup

Currently Reading

NICK BOSTROM SUPERINTELLIGENCE Paths, Dangers, Strategies

Wikipedia Articles I enjoy

  1. Why artist payment rises without productivity increases:
  2. Nick Bostrom’s Simulation Hypothesis:
  3. Seven Bridges of Königsberg:
  4. Gombe Chimpanzee War
  5. Cisgender
  6. 2147483647
  7. Monkey Selfie
  8. Erdős–Bacon number
  9. Dolgopolsky list
  10. Bus Factor
  11. Graham’s number
  12. Alexander Stepanov
  13. Mojibake
  14. Fool’s Gold Loaf
  15. Sturgeon’s Law
  16. Project West Forward
  17. Mammalian diving reflex
  18. Lists of lists of lists

Thomas Jefferson to Isaac McPherson

If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it.

Thomas Jefferson

Nobody Understands Punctuation

If make his point clear, Yoda could, give a shit about Oxford commas, nobody should. – Peter Huntwelch

Nobody Understands Punctuation

The Programmer

The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures… Yet the program construct, unlike the poet’s words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. […] The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.

– Fred Brooks

Things to look at, when I have time

Movies

TitleYear
Old Joy2006
Sunset Boulevard1950

Art

TitleArtistYear
RhinocerosAlbrecht Dürer1515
Carcass of BeefChaïm Soutinec. 1925
The Knight’s DreamAntonio de Pareda1655
The Death of MaratJacques-Louis David1793
Homage to a SquareJosef Albers1962

TV Shows

TitleDate
Civilisation1969

Thomas Edison was an awful human being

There ain’t no rules around here. We’re trying to accomplish something.

– Thomas Edison

All Good Slides Are Slippery

Poetry is like a curvy slide in a playground - an odd object, available to the public - and, as I keep explaining to my local police force, everyone should be able to use it, not just those of a certain age.

– Lemony Snicket

http://www.poetryfoundation.org/poetrymagazine/article/246328

Discourse on Inequality

The first man who, having fenced in a piece of land, said ‘This is mine,’ and found people naïve enough to believe him, that man was the true founder of civil society. From how many crimes, wars, and murders, from how many horrors and misfortunes might not any one have saved mankind, by pulling up the stakes, or filling up the ditch, and crying to his fellows: Beware of listening to this impostor; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.

– Jean-Jacques Rousseau, Discourse on Inequality, 1754

http://www.constitution.org/jjr/ineq.txt

ASCII Magic Eye

The following block of characters is an ASCII “Magic Eye” Random-Dot Stereogram. Stare at it with your eyes focused at infinity and you will eventually see a diamond suspended between two rows of columns.

               O               O               O               O
lP#83U<c="Gyw*C|lP#83U<c="Gyw*C|lP#83U<c="Gyw*C|lP#83U<c="Gyw*C|lP#83U<c="Gyw*C
MGB9q+s^{O!do5NEq+s^{OO!do5NNEq+s^^{OO!djo5NNEq+s^{OO!dj5NNEq+^{OO!d5NNEq+^Zq+^
fw;zUK`o^`/D*+8fUK`o^``/D*+88fUK`oo^``/DC*+88fUK`o^``/DC+88fUKo^``/D+88fUKo"UKo
_i-lSmj$\b0e`mx=Smj$\bb0e`mxx=Smj$$\bb0eA`mxx=Smj$\bb0eAmxx=Sm$\bb0emxx=Sm$?Sm$
MtfCG_L{55Zk\6$"G_L{555Zk\6$$"G_L{{555Zk,\6$$"G_L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c=8''gXZHnPP2c8''gXZHyXZH
\"I7/$k\S(#qD%)z/$k\S((#qD%))z/$k\\S((#qVD%))z/$k\S((#qV%))z/$\S((#q%))z/$\J/$\
BgaE^p#]$Wn*O@US^p#]$WWn*O@UUS^p#]]$WWn*OO@UUS^p#]$WWn*O@UUS^p]$WWn*@UUS^p]%^p]
eqzjLx8LVCEqqLvOLx8LVCCEqqLvvOLx8LLVCCEqZqLvvOLx8LVCCEqZLvvOLxLVCCEqLvvOLxLHLxL
bB:8nfa]BJ6)zQ>ybB:8nfa]BJ6)zQ>ybB:8nfa]BJ6)zQ>ybB:8nfa]BJ6)zQ>ybB:8nfa]BJ6)zQ>

                                               (created by [email protected])

The Phonetic Alphabet

A - Alpha    G - Golf    N - November  U - Uniform
B - Bravo    H - Hotel   O - Oscar     V - Victor
C - Charlie  I - India   P - Papa      W - Whiskey
D - Delta    J - Julia   Q - Quebec    X - X-Ray
E - Echo     K - Kilo    R - Romeo     Y - Yankee
F - Foxtrot  L - Lima    S - Sierra    Z - Zulu
             M - Mike    T - Tango