code:
#    -*- mode: org -*-

Archived entries from file /home/joshua/manuals/cheatsheets/hurd.org

* DONE pressing up and down in Hurd console doesn't work
CLOSED: [2016-11-08 Tue 07:52]
:PROPERTIES:
:ARCHIVE_TIME: 2016-11-08 Tue 18:00
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: bug notes/Hurd bugs
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2016-11-08 Tue 07:52]
:END:
http://savannah.gnu.org/bugs/?15485

But I think that it actually is.

I replied on the bug that when I'm not in X, the up and down keys work just fine.

Samuel Thibault closed this bug!  Apparently it must have worked when the Hurd moved to xkb.

Cool.

* the two servers in the Hurd that a special
:PROPERTIES:
:ARCHIVE_TIME: 2017-11-25 Sat 14:31
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: Documentation things/Mach
:ARCHIVE_CATEGORY: hurd
:END:

The auth server.  This is the server that all programs trust to establish the identity of other servers.

The process server controls system components and does global booking oporations.

* DONE wine now works well
CLOSED: [2018-10-26 Fri 12:04]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-26 Fri 12:04]
:END:
http://www.gnu.org/software/hurd/open_issues/wine.html

It can be removed from this web page:  http://www.gnu.org/software/hurd/tag/open_issue_porting.html

https://wiki.winehq.org/Hurd

* DONE physical memory management bit is outdated.  The hurd now has a buddy allocator.
CLOSED: [2018-10-26 Fri 12:04]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-26 Fri 12:04]
:END:
https://www.gnu.org/software/hurd/community/gsoc/project_ideas.html

* DONE hurdish TCP/IP stack  there was a successful lwip gsoc?
CLOSED: [2018-05-03 Thu 21:24]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-05-03 Thu 21:24]
:END:

This has been done with Lwip.
https://www.gnu.org/software/hurd/community/gsoc/project_ideas.html

* DONE new driver approach mentions DDE.  It should mention rump
CLOSED: [2018-10-27 Sat 09:57]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-27 Sat 09:57]
:END:

* DONE xattr support can be removed from the project ideas page
CLOSED: [2018-10-29 Mon 15:10]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-29 Mon 15:10]
:END:
http://www.gnu.org/software/hurd/community/gsoc/project_ideas.html

* DONE add a comment that pfinet may be placed with lwip someday and link to lwip
CLOSED: [2018-10-29 Mon 15:58]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-29 Mon 15:58]
:END:

file:///home/joshua/programming/gnu/hurd/hurd-web.rendered/open_issues/pfinet.html

file:///home/joshua/programming/gnu/hurd/hurd-web.rendered/open_issues/pfinet_timers.html

file:///home/joshua/programming/gnu/hurd/hurd-web.rendered/open_issues/pfinet_vs_system_time_changes.html

* DONE create an lwip webpage
CLOSED: [2018-10-29 Mon 15:58]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-29 Mon 15:58]
:END:

* DONE [[file:~/programming/gnu/hurd/web/dde.mdwn::%5B%5B!meta%20copyright="Copyright%20%C2%A9%202009,%202010%20Free%20Software%20Foundation,%20Inc."%5D%5D][DDE webpage needs to recommend rump]] it doesn't
CLOSED: [2018-10-29 Mon 15:58]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-29 Mon 15:58]
:END:
https://www.gnu.org/software/hurd/dde.html
http://wiki.tudos.org/DDE/DDEKit

* DONE add a shepherd wiki webpage point to it from the upstart and systemd pages
CLOSED: [2018-11-01 Thu 11:49]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-11-01 Thu 11:49]
:END:

* DONE combine the contributers page and
CLOSED: [2018-10-29 Mon 15:58]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-10-29 Mon 15:58]
:END:
https://www.gnu.org/software/hurd/contributing.html#index4h2
and https://www.gnu.org/software/hurd/hurd/running/qemu.html pages.

There should be one page which shows how to download and run the program.

One page should build on that to show how to set up the development environment

* DONE add more OS books/ways to learn OS things to this page
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
file:///home/joshua/programming/gnu/hurd/hurd-web.rendered/documentation.html
CLOSED: [2018-11-02 Fri 12:06]
:LOGBOOK:
- State "DONE"       from              [2018-11-02 Fri 12:06]
:END:

* DONE is the 830 MB Ram limit page outdated?
CLOSED: [2018-11-08 Thu 09:58]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-11-08 Thu 09:58]
:END:
[[file:~/programming/gnu/hurd/hurd-web/faq/ram_limit.mdwn::limit%20between%20kernelland%20and%20userland%20in%20`i386/include/mach/i386/vm_param.h`.]]

file:///home/joshua/programming/gnu/hurd/hurd-web.rendered/faq/ram_limit.html

* DONE update the Hurdish TCP/IP Stack
CLOSED: [2018-11-08 Thu 10:06]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-11-08 Thu 10:06]
:END:

* DONE update the image on the microkernel page.
CLOSED: [2018-11-26 Mon 10:22]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-11-26 Mon 10:22]
:END:

Samuel likes the image, but he would prefer if I mention the glibc layer of the Hurd.

file:///home/joshua/programming/gnu/hurd/hurd-web.rendered/microkernel.html

* DONE update the current PCI arbiter webpage
CLOSED: [2018-11-26 Mon 10:26]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-11-26 Mon 10:26]
:END:

https://www.gnu.org/software/hurd/open_issues/pci_arbiter.html

http://www.tech-pro.net/intro_pci.html

https://archive.fosdem.org/2018/schedule/event/microkernel_hurd_pci_arbiter/

https://en.wikipedia.org/wiki/Arbiter_(electronics)

[[file:~/programming/gnu/hurd/hurd/pci-arbiter/TODO::-%20add%20"--pci%2000:1f.3"%20option%20to%20easily%20specify%20a%20PCI%20device%20instead%20of%20having%20to][todo things for the PCI arbiter]]

http://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=PCI+Arbiter&submit=Search%21&idxname=bug-hurd&max=20&result=normal&sort=score&whence=20

http://lists.gnu.org/archive/html/bug-hurd/2015-09/msg00055.html

http://lists.gnu.org/archive/html/bug-hurd/2018-01/msg00071.html
http://lists.gnu.org/archive/html/bug-hurd/2018-10/msg00017.html

This one mentions some shortcomings of the PCI arbiter code
http://lists.gnu.org/archive/html/bug-hurd/2017-12/msg00005.html

http://lists.gnu.org/archive/html/bug-hurd/2017-12/msg00048.html

http://lists.gnu.org/archive/html/bug-hurd/2018-01/msg00031.html

http://lists.gnu.org/archive/html/bug-hurd/2017-10/msg00019.html

* DONE add info about SMP from this [[gnus:bug-hurd#o63zw5.piclzl.1bquebl-qmf@smtp.gmail.com][email]] to the Hurd wiki
CLOSED: [2018-12-03 Mon 15:54]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-12-03 Mon 15:54]
:END:

* DONE change the command from kvm -> qemu-system-i386 to start the Hurd
CLOSED: [2018-12-13 Thu 11:07]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-12-13 Thu 11:07]
:END:

* DONE I can make the open issues 64-bit support more explicit
CLOSED: [2018-12-18 Tue 10:07]
:PROPERTIES:
:ARCHIVE_TIME: 2018-12-18 Tue 10:22
:ARCHIVE_FILE: ~/manuals/cheatsheets/hurd.org
:ARCHIVE_OLPATH: wiki/wiki things that need changed
:ARCHIVE_CATEGORY: hurd
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE"       from              [2018-12-18 Tue 10:07]
:END:

[[file:~/programming/gnu/hurd/hurd-web/open_issues/64-bit_port.mdwn::What%20is%20left%20for%20initial%20support%20(32-on-64)%20is][initial here]]

Basically, I should change

What is left for initial support (32-on-64) is

to The GNU/Hurd is difficult to port completely to 64-bit.  It's easier to have a 32-bit GNU Hurd running on top of a 64-bit GNU/Hurd.

repo_name: hwpplayers/cheatsheets

license: mit


code:
#+AUTHOR: Joshua Branson
#+TITLE: Common Networking Programs
* Inetutils Cheatsheet
This cheatsheet covers some of the basics of the GNU OS.  It is based on the inetutils manual.

** Common Options
 All programs accept

 - =--help=

 - =--usage=
   how to use the program
 - =--version=
   the version number

** Exit Status
 Almost all programs have an exit status of 0 to mean success.
 non-0 means failure.

** dnsdomainname
 will show the you the domain part of the fully qualified domain name.

** hostname

hostname [option]
hostname NAME

- =-d= get the domain name
- =-f= fully qualified domain name
- =-i= get the IP address

get the hostname

** traceroute [option] HOST
[[info:inetutils#traceroute%20invocation][info:inetutils#traceroute invocation]]

- =-f NUM=
  make the package that you are sending not report information on the NUM of routers closest to you.
  So if you know that there are 10 routers between you and the remote, this makes the package ignore the
  first NUM routers

- =-g GATES=
  I can specify which gateways I want to send my package through.  The gates are specified by their hostname, IP address, and are seperated by commas, semicolans, or spaces.  At most 8 may be specified

- =-I=
  Use ICMP ECHO datagrams for probing the remote host

- =-m NUM=
 set the maximum time to live allowed for probing.  In other words stop probing when the hop distance is in excess of NUM.

- M METHOD
  Use either icmp or udp as the method to transfer packets

-p PORT
 set the destination of the target port

 --resolve-hostnames
 Attempt to resolve all addresses as hostnames

** ftp [OPTION...] [HOST [PORT]]
Once you are connected several commands become available
- ls print dir on remote machine
- lpwd pwd on local
- cd change directory or the remote
- lcd change directory on the local
- get remote-file [local file]
- put local-file [remote file]

** rcp
Copy files between remote machines

** rexec
Perhaps I could use this save files on a remote machine with ftp
execute a program on a remote machine
rexec --user=LOGIN --password=PASS --host=HOST [OPTION] COMMAND

** rlogin
 login to a remote server

** rsh
 executes commands on a remote host and copies the local stdin to that of the remote commands.  It also takes the remote standard output and makes it the local input!

 And I can do this

 #+BEGIN_SRC sh
 ln -s $(which rsh) HOSTNAME
 HOSTNAME ls
 #+END_SRC

Afterwards, HOSTNAME will be passed to 'rsh' as host name whenever the
command HOSTNAME is issued.

** talk PERSON [ttyname]

 If you wish to talk to someone on your machine, the person is just the username of the person on your machine, if the person is on a different machine then use username@host

 ttyname is typically of the form ttyXX

** tftp


code:
#+AUTHOR:Joshua Branson
#+TITLE: Inkscape
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Inkscape

* change layout from horizontal to portrait

File > Document Properties

And fiddle with width and height.

* change fill and stroke

C-Shift-f

* draw an arrow

Draw a line like normal.

C-S-f  and select stroke style

and pick an arrow from the 3 drop down options

* disable snapping to corner with the %


code:
* vocabulary

** chain
A set of specifiers that correspond to ip4/ip6 packets

** target
1 specifier that tells the kernel what to do with a matching packet.

** firewall rule

lists details for a packet and target.  If the packet does match the target, the target can refer what to do via a user defined chain, a target described in iptables-extensions, or it can be ACCEPT, DROP, or RETURN.

** ACCEPT
let the packet through

** DROP
drop the packet.  Don't let it come through

** RETURN
stop looking for what to do in this chain, go back to the previous chain and figure out what to do there.

** filter table
There are many different tables, but this is the default.  It contains INPUT for packets that are going to local sockets. FORWARD packets that are going through the box, and OUTPUT for locally generated packets.

* Creating a simple firewall
** Naming the 2 chains
#+BEGIN_SRC sh
su
iptables -N TCP
iptables -N UDP
#+END_SRC

#+RESULTS:
** drop all incoming connections by default
#+BEGIN_SRC sh
su
iptables -P INPUT DROP
#+END_SRC

#+RESULTS:
** allow all outgoing traffic
#+BEGIN_SRC sh
su
iptables -P OUTPUT ACCEPT
#+END_SRC

#+RESULTS:
** white list some incoming connections
#+BEGIN_SRC sh
su

#+END_SRC

#+RESULTS:
** drop INVALID traffic
#+BEGIN_SRC sh
su
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
#+END_SRC

#+RESULTS:
** accept ping requests
#+BEGIN_SRC sh
su
 iptables -A INPUT -p icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT
#+END_SRC

#+RESULTS:
** more random stuff that I don't understand
#+BEGIN_SRC sh
su

 iptables -A INPUT -p udp -m conntrack --ctstate NEW -j UDP

 iptables -A INPUT -p tcp --syn -m conntrack --ctstate NEW -j TCP

#+END_SRC

#+RESULTS:

#+BEGIN_SRC sh
su
iptables -A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable

iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
#+END_SRC

#+RESULTS:

#+BEGIN_SRC sh
su
iptables -A INPUT -j REJECT --reject-with icmp-proto-unreachable

#+END_SRC

#+RESULTS:
** Allow certain incoming connections
*** accept incoming connections on port 80/443 for a web server
#+BEGIN_SRC sh
su
iptables -A TCP -p tcp --dport 80  -j ACCEPT
iptables -A TCP -p tcp --dport 443 -j ACCEPT
#+END_SRC

#+RESULTS:
*** allow


code:
#+AUTHOR:Joshua Branson
#+TITLE: Irc
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Irc

** commands

- /list
  List all of the popular chat rooms.


code:
#+TITLE:Isync Cheatsheat
#+AUTHOR:Joshua Branson
#+OPTIONS: H:10 toc:nil

* Introduction to Isync
Isync fetches your email (like from your gmail account) and stores it locally on your computer.  Then, any email client that you run on your machine can fetch your mail in a local directory.  This makes browsing your email SUPER fast, and possible when you are not connected to the internet!  The email client must support Maildir or IMAP4 mailboxes, which is the format that isync saves your mail on your machine.  One should really use Maildir's because those seem to be the standard.  Though Dovecat has an alternative standard that is also really fast too.

** Vocab
- Stores
  A store is either a remote or local folder.  This could be your gmail inbox folder, sent folder, drafts folder, etc.
- Channel
  A channel connects two Stores whilst also describing how they are synchronized. A channel might be "messages I've wrote", and it combines the stores gmail sent and draft folder.
- Accounts
  An Account describes the connection to a server.  This is something like imap.gmail.com.
- Group
  A group connects multiple channels.  On the command line, one might say mention gmail to examine their gmail inbox.

* A working isync account from 1 email can be done by placing the following in your ~/.mbsyncrc

#+BEGIN_SRC org
  IMAPAccount gmail
  # Address to connect to
  Host imap.gmail.com
  User jbranson@waypoint.agency
  Pass SECRETPASSWORD
  # To store the password in an encrypted file use PassCmd instead of Pass
  # PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
  #
  # Use SSL
  SSLType IMAPS
  # The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.
  CertificateFile /etc/ssl/certs/ca-certificates.crt
  #CertificateFile ~/.cert/imap.gmail.com.pem
  #CertificateFile ~/.cert/Equifax_Secure_CA.pem

  IMAPStore gmail-remote
  Account gmail

  MaildirStore gmail-local
  # The trailing "/" is important
  Path ~/.mail/gmail/
  Inbox ~/.mail/gmail/Inbox

  Channel gmail
  Master :gmail-remote:
  Slave :gmail-local:
  # Exclude everything under the internal [Gmail] folder, except the interesting folders
  Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
  # Or include everything
  #Patterns *
  # Automatically create missing mailboxes, both locally and on the server
  Create Both
  # Save the synchronization state files in the relevant directory
  SyncState *
#+END_SRC


code:
* Javascript manual
** Objects and functions
   Suppose, you have an object declared like this
   var person = {
   height : 6,
   weight : 200,
   change : function () {
   this.height = 5;
   }
   }

   When you first make this object like this:

   var joshua = new person();

   Then Joshua starts with a height of 6. But when you call his change method:

   joshua.change();

   Joshua’s height is now 5. So,

   joshua.height will evaluate to 5.


code:
* JSON  (Javascript Object Notation) What is it?
  JSON is a subset of javascript that lets you declare an object’s members and values as well as all of its children’s members and
  values. The values that JSON can specify are:
** a number
** a string
** a boolean (true or false)
** an array (in square brackets)
** an object (in curly braces)
** null
* Basic example of syntax
** Create an object with lots of members with curly brackets {}:
   var person = {
   “firstName” : “John”,
   “lastName”  : “Doe”,
   “height”    : “6”,
   “single”    : true,
   “pet”       : null
   }

   person.firstName --> “John”
   person.pet       -->  null
** Create an object with members and a child array with brackets [];
   var teacher = {
   “name”   : “Mr. Boss”,
   “classSize” : “20”,
   “students” : [
         “student1” : “Greg”,
         “student2” : “Jane”
   ]
   }

   teacher.name  --> “Mr. Boss”
   teacher.students[0].student1 --> “Greg”


code:
#+AUTHOR:Joshua Branson
#+TITLE: Kino Wear Bible
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Kino Wear Bible

Only buy/wear something if it fits.
avoid logos and images and branding on clothing.  People should have to pay me to wear their brands.
Accessories can be a good way to save money.  A $10 accessory belt can look as good as a $100 one.
Looking better gets you compliments.  People subconsciously respect you more.
  - Just today 2 people complimented my outfit.  One of them was a manly man that I admire a lot!
    [2016-10-03 Mon]
When you are just starting wear a about 3 colors.  Try not to do too many colors.  You might end of looking like a clown.

peach won't work with my skin color
slighter bright blue with bring out my eyes
ties might be hard to wear with Chinos
A streamer will launder my dress shirts and pants
I can wear an under-layer for pants to let it collect sweat

business casual does not necessarily mean tie
dress shirt is measured by neck and length of shirt

regular shirts are small medium and large

is texture good?

a textured tie is good with a non-textured shirt

Try to wear complimentary colors.  Colors on the opposite side of the color spectrum

Being EDGY at work might not be good at Purdue.  They are conservative.
might not be good to wear suit jacket and hoodie
Or suit jacket with jeans.
wash your clothes in the proper way on the label.  They will last longer.

Bottom of page 36.  Good joke.

* does the dress shirt fit?
- collar need to be stiff
- should stitching-needs to align with break of shoulder bone
- shirt should mold to the shape of my chest
- the armpit shouldn't have more than .5 Flatt fabric.
  I think that means that when I lift my arms up, it shouldn't sag
  more than half an inch.
- only one fist can fit between the shirt and my hip.

They get dirty easy.  So perhaps don't spend too much.  Perhaps don't wear
them to parties where you will get all sweaty and dirty.

$200 should be the most that you spend on a shirt.

* jeans raw blue jeans
p. 40
raw denim
blue raw
I can find decent jeans at
Nudie
Acne
Naked and Famous


code:
#+STARTUP: latexpreview
#+TITLE:Latex Cheatsheat
#+AUTHOR: Joshua Branson
* Math
#+STARTUP: latexpreview
\[
\fraq{5}{6}
\]

\begin{equation}
x = a_0 + \cfrac{1}{a_1
+ \cfrac{1}{a_2
+ \cfrac{1}{a_3 + \cfrac{1}{a_4} } } }
\end{equation}


code:
#+TITLE:Ledger Cheat Sheet
#+AUTHOR:Joshua Branson
* Accounting Concepts
** Double Entry Accounting
   Ledger is a double entry accounting system.  This means ledger is like the law of thermodymnics.  No energy is ever lost or destroyed.  In the same way no money is ever lost or destroyed.  So in ledger to say that you made $500 from your paycheck, your boss gave you $-500 dollars.

   #+BEGIN_SRC ledger
     2015/11/25  Paycheck
         Assets:Checking      $25.00
         Income:Salary        $-25.00
   #+END_SRC
** The ultimate aim of ledger

The ultimate goal is ledger is to show you how much money you can spend.

Most older folks you a checkbook journal to record their withdraws from their checking account.  Ledger is a general journal.  It records additions and subtractions (credits and debits).

** Making Transactions
  Transactions happens when you money either leaves your bank account or enters your bank account. There are several possible
  initials characters that Ledger must see when reading a transaction.

  - Date
    DATE[=EDATE] [*|!] [<CODE>] DESC

    If * follows the date, then it means that the trasaction has cleared.
    If ! follows the date, it means that the transaction is pending.

    The next line that follows must be
    ACCOUNT AMOUNT [; NOTE]

  - =
    An automated transaction

  - ~
    A periodic transaction.

  - ; # % | * are all comments

  - 'indented ;'
    If a comment is indented inside a transaction, it is parsed as persistent.   This lets you tag certain types of transactions.

    Some examples
#+BEGIN_SRC ledger
2017/05/10 ! bought groceries
    Expenses:Groceries   $35
    Assets:Bank account
#+END_SRC

Notice that the date is formatted as YEAR/MM/DD.

This is a pending transaction.  You swiped your card, but your bank has not released the funds yet.

#+BEGIN_SRC ledger
2017/05/10 * bought DVD
    Expenses:Entertainment  $5
    Assets:Bank account
#+END_SRC

This is a complete transaction.  I swiped my card, and the bank has let go of my funds.
** Commands
You can get an overview of your transactions via this ledger command:

It primarily shows you your transactions.

#+BEGIN_SRC sh :results output :exports both
ledger -f <ledger file> balance
#+END_SRC

It's also probably a good idea to set up some default ledger accounts.  This way, ledger will warn you if one of your transactions contain a misspelling.  Perhaps you could have some accounts like so:

#+BEGIN_SRC ledger
account Expenses:Cash
    alias envelopes

account Expenses:Insurance
    alias insurance

account Expenses:Tithe

account Expenses:Groceries
    alias groceries

account Expenses:Auto:Gas
    alias gas

account Expenses:Date
    alias date

account Expenses:Tithe
    alias tithe

account Expenses:Rent
    alias rent

account Expenses:Electric
    alias electric

bucket Assets:Bank Account
#+END_SRC

If you also use the "--strict option" and you accidentally spell "Expenses:bank accout", Ledger will warn you that you've made a mistake.

#+BEGIN_SRC sh :results output :exports both
ledger balance -f budget.ledger
#+END_SRC

You can also get a detailed report of your monthly expenses:

#+BEGIN_SRC sh :results output :exports both
ledger -M register -f budget.ledger
#+END_SRC

This output can look a bit too much.  What if you only want to see what you spent on Rent last month?  You could do this:

#+BEGIN_SRC sh :results output :exports both
ledger --strict -f budget.ledger Expenses:Rent
#+END_SRC

You can also limit transactions to after a begin date

#+BEGIN_SRC sh :results output :exports both
ledger --strict -f budget.ledger -b '2018/06/01'
#+END_SRC

** I can have ledger schedule transactions like my paycheck
[[info:ledger-mode#Transactions%20that%20occur%20on%20specific%20dates][info:ledger-mode#Transactions that occur on specific dates]]

** vocab
- journals
  This is a record of all money transactions.  This essentially is what ledger tries to provide.
- credits
  Credits are deposits or additions.  This is money going to an account.
- debit
  Debits are subtractions or withdraws from accounts.
- payee
  This is the person or company that money goes to.  If you have a withdraw (subtraction) from your bank account, you usually put that money somewhere or to someone.  That somewhere (or someone) is the payee.
- checkbook journal
  This is a journal describing all of the withdrawls from your checking account.
- accounts
  Generally, people think of accounts as bank accounts.  Or places that one can store money.  Ledger defines accounts as any place that money can go to.  So, your electric bill is considered an account, because your money goes to pay your electric bill.

* Stuff Ledger Can Do
  [[info:Archive%20old%20Records][Archive old Records]]
** If I make a mistake and I need to add a dummy transaction:  5.10.3
** 5.22 automatic transactions
** 5.22.7  tithing
** 7.2.4 combine ledger with emacs org-mode

I can use no-web or tangle
** Transactions can have tags.

#+BEGIN_SRC ledger
2018/07/05 * Dinner and a movie
      Expenses:Entertainment   $30
      Assets:Bank Account
      ; :SILLYTAG:
#+END_SRC

Tags can also have values

#+BEGIN_SRC ledger
2018/03/01 * lost bet on the baseball game
    Expenses:Gambling     $20
    Assets:Bank Account   $20
    ; Jeff is smarter than me.  He bet $0.
    ; JEFF:0
#+END_SRC

* journaling
  - alias
    alias Dining=Expenses:Entertainment:Dining
    alias BMovie=Expenses:Entertainment:Bought Movie

  - assert
    throw an error if something is not met while Ledger runs through this file
    assert <VALUE EXPRESSION BOOLEAN RESULT>

  - bucket
    Make one account the default account to balence my checkbook with.  IE, everytime that I make a transaction, I have to
    have 2 transactions.  So when I buy a movie, the first transaction is a debit on my bank.  The second transaction gives the
    same amount of money to walmart.
    Instead of writing

    2011/01/27 Book Store
    Expenses:Books                       $20.00
    Assets:Checking                      $-20.00

    2011/12/01 Sale
    Expenses:Entertainment:Date            $ 30.00
    Assets:Checking                        $-30.00

    I write

    2011/01/27 Book Store
    Expenses:Books                       $20.00

    2011/12/01 Sale
    Expenses:Entertainment:Date            $ 30.00

    And ledger is smart enough to know what I mean.

  - capture

    Capture is amazing.  It lets you replace any regexp with an account name.  It's like alias on steroids

    =capture Expenses:Debt:"College Loan"   Debt=

    Now any time I write Debt as an occount, ledger know I'm referring to Expenses:Debt:"College Loan"

  - define

    Let's me define expressions for future use.

    For example, let's say that my rent is currently $500 a month.

    define rent=$500

    2015/05/01  Rent
    Expenses:Rent    rent

    If sometime later rent changes I can just update the cost of rent

    define rent=$600

    You can also use define variables like

    (rent*2)

  - include
    Include a stated file as if it were part of the current file.
    This lets you break up your ledger files into multiple files.  You can break them up by month for example

  - apply tag
    Let's you apply a certain type of tag for all of the following transactions until and =end apply tag= is found.

              apply tag hastag
          apply tag nestedtag: true

          2011/01/25 Tom's Used Cars
              Expenses:Auto                    $ 5,500.00
              ; :nobudget:
              Assets:Checking

          2011/01/27 Book Store
              Expenses:Books                       $20.00
              Liabilities:MasterCard

          end apply tag

          2011/12/01 Sale
              Assets:Checking:Business            $ 30.00
              Income:Sales

          end apply tag

     is the equivalent of:

          2011/01/25 Tom's Used Cars
              ; :hastag:
              ; nestedtag: true
              Expenses:Auto                    $ 5,500.00
              ; :nobudget:
              Assets:Checking

          2011/01/27 Book Store
              ; :hastag:
              ; nestedtag: true
              Expenses:Books                       $20.00
              Liabilities:MasterCard

          2011/12/01 Sale
              ; :hastag:
              Assets:Checking:Business            $ 30.00
              Income:Sales

  - year <year>
    This lets you specify a year for all the following transactions that don't specify one
** How to make a monthly/yearly budget 9.1

I just need to set a periodic transaction at the top of my ledger file.

#+BEGIN_SRC ledger
; there are my monthly expenses
~ Monthly
    rent                        $1000
    Expenses:Auto:Gas           $80
    Expenses:Groceries          $500
    Expenses:Tithe              $100
    Expenses:Debt               $200
    Expenses:Electric           $100
    Assets

#+END_SRC


code:
#+AUTHOR:Joshua Branson
#+TITLE: LFTR
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* LFTR
** It uses 99% of the fuel and only 1% is left.  That 1% is Plutonium-238, which NASA is desperate for.
It's how all of NASA's deep space missions operate.  Plutonium-238 is worthless for bombs.  Plutonium-239 is really good for bombs.

1,000 KG,  only 15 kg of plutonium-238 is left over.  That's 98.5% of fuel being used.  (https://youtu.be/P9M__yYbsZ4?t=4391)

The U.S. in the only country in the world that has sent space probes beyond the asteroid belt, and it's been based on
Plutonium-238.
** could make Molybdenum-99, which is used for diagnostic procedures.
https://youtu.be/P9M__yYbsZ4?t=4414

Canada shut it down in 2015.  (check this)
** Bismuth-213 cancer research.  Alpha emitting particle.  All cancer research is based on beta emitting particles
https://youtu.be/P9M__yYbsZ4?t=4441

Beta has a big kill radius and is not very direct-able.

Alpha is great for dispersed cancers leukemia, pancreatic.

bismuth 213 can only be generated from the decay of uranium-233.  https://youtu.be/P9M__yYbsZ4?t=4520
** low pressure operation
Don't need 9 inch thick steel.  Huge concrete confinement areas.

https://youtu.be/P9M__yYbsZ4?t=4659
** don't need to fabricate or enrich fuel.
https://youtu.be/P9M__yYbsZ4?t=4666
** No disposal approach.
** Huge level of safety

https://youtu.be/P9M__yYbsZ4?t=4676
** civilian nuclear power in the U.S.  has not killed anyone.
https://youtu.be/P9M__yYbsZ4?t=5119
** linear no threshold hypothesis

Not based on epidemiological data.

It's based on the assumption that radiation will harm you at whatever degree to whatever degree you are exposed.

It is established in policy, but there is no study that confirms this.  No study says, we have taken a small portion of people, exposed them to 1% for radiation, and have seen 1% more cancer.  In fact, there are many places in the world where background radiation is substantially higher than elsewhere.  But those areas have less areas of cancers.

Hormesis a little bit is good for you.

https://youtu.be/P9M__yYbsZ4?t=5133

People aren't really worried about natural radiation.  artificial radiation is the same thing.

NORM naturally occurring radioactive materials. Frack a shale and pull gas out, a lot of radon comes out too.  You burn the gas that radon is being released.

Coal contains small amounts of thorium and uranium.  They get dispersed in the air.

Coal releases more radiation that nuclear power plants do.

A sunburn is radiation damage.  It's radiation burn.
** radon is the biggest amount of radioactivity
It comes out of the ground and we are breathing it right now

https://youtu.be/P9M__yYbsZ4?t=5378
** burning fuel you get 30% of the energy
When you put $1 in your car in gas, kill 60 cents goodbye.

10% goes away on transmission lines.

https://youtu.be/P9M__yYbsZ4?t=5489
** china is going LFTR
** he said that LFTR uses fluoride as a fuel
I thought thorium was the fuel?
** 1 kilogram of fissile material produces as much energy as 13,000 barrels of oil.
** Thorium-232 (natural thorium) is not a nuclear fuel,
but if it consumes a neutron, then it'll become TH-233, which has a half life of 20 minutes. WOW!
TH-233 decays into Protactinium-233, which in one month will decay into uranium-233 an ideal fuel.
Thermal reaction...?

If you hit uranium-233 with a neutron, it'll fission and release a neutron that'll hit natural thorium
to start the whole thing all over.
** reactors today burn uranium-235, which is like burning platinum.
** molten salt reactor
LFTR is a type of molten salt reactor
** ARE
Aircraft reactor experiment
a proof of concept molten salt reactor that ran for 100 hours reaching temperatures up to 1150 K
ran for 11 days.
operated from <1954-11-03 Sun>-<1954-11-12>

Very stable...as salt heated up, less fissile material in the core.  So fission became less likely.

As the salt cooled down, there was more fissile material in the core, so fission become more likely.

This is a dynamically stable system.
** molten salt reactor experiment
ran from 1965-1969
** 2 fluid MSR design.
Core fluid (lithium bar ilium salt ) with uranium tetra-fluoride in there.

* Bruce Hoglund
MSR research


code:
#+TITLE: Libreboot info
#+AUTHOR: Joshua Branson

* what are these weird cables coming from my laptop?

<maccraft> red and blue are for 3g modem, white, gray and black are for wifi
                                                                        [16:21]
<maccraft> that wide connector on a "tape" is for panel and indicator
           lights(sometimes microphone)
<maccraft> on 3g modem card you should have markings for red and blue. for
           wifi google it. i don't know   [16:23]

* I do not even have to build the flashrom!  Flashrom is in the debian archive!
  https://libreboot.org/docs/gnulinux/grub_cbfs.html

$ sudo apt-get install flashrom

I should edit this is the website, because this website is one caotic mess!

* ok I am supposed to use the textmode rom images for the first flash.

https://libreboot.org/docs/gnulinux/grub_cbfs.html

I want to use textmode for the first flash, because textmode includes
a memtest, which you should always run after installing libreboot.

* Preparing for the installation

  If you've decided that you want to use libreboot!  Congratulations.
  You are about to use a free BIOS!  To perform the installation you
  will need:

  - a rasberry PI Model B or B+ *OR* a beagle bone black
  - essential things for the PI
    - a keyboard
    - a mouse (optional, but useful)
    - computer screen
    - HDMI cable to connect the screen to the PI
  - 6 female jumper cables.
  - a 16 Panorma clip and/or a 8 clip Panorama clip

  If you have Linux already installed on your laptop, then /before you
  disassemble your T200, T400, T60, etc. laptop/, install the flashrom
  util =apt-get install flashrom=, and run the command =flashrom -p
  internal=.  The output of that command should tell you the size of
  the flash chip.  It could be 4MB, 8MB, or 16MB.  The utility should
  say =8192 Kb= if it is a 8MB chip.  You can still check your chip
  size later on, but this is the easiest way to do it.

  After you have done that, you may want to take a look at the guides
  online about possible upgrading your CPU.  Libreboot supports
  certain CPU models.  Since you are taking apart your laptop, now
  might be a good time to upgrade the CPU.  Also take a look at your
  RAM.  You might want to consider upgrading your RAM, since you are
  going to take apart your laptop.  Also libreboot may not support
  your RAM.  You might want to check online, which RAM libreboot
  supports. [fn:1]

  After you have done that, ensure that you have a rasberry pi or
  beagle board and some female wires (10 females wires is plenty), and
  a panorama clip.  Your flash chip will either have 8 or 16
  connection points.  You will /only know/ once you take your laptop
  apart.  You could buy two panorama clips, or just buy the 16 port
  one.  If you know what you are doing, then you can use the 16 port
  one on an 8 port chip.

  Now that you have all the parts that you need, go ahead and take your
  laptop apart.  This guide, though quick, will give you some idea of
  how to take everything apart for the T400.

  https://invidio.us/watch?v=xH1Gg-OhBH4

  https://libreboot.org/docs/install/rpi_setup.html

  A dedicated 3.3V PSU was used to create this guide, but at ATX PSU
  is also fine: (I believe my Macbook has an ATX PSU, this was
  developed by Intel).

  Please note that this guide uses notation to help distinguish that
  you should run commands on a laptop vs. on the pi.  They are:

  - =pi$= run this command as a regular user on the pi.
  - =pi#= run this command as root on the pi.
  - =x86$= run this command as a regular user on the computer.
  - =x86#= run this command as a root user on a computer.

** Upgrade your EC firmware version

   If you are librebooting a Lenovo laptop X60, T60, X200, T400, T500,
   R400, or W500, then you need to update your laptop to the latest EC
   firmware version (version 1.06). Lenovo has some firmware for the
   laptop.  Once you install Libreboot, there is no known way to
   update your EC firmware version.

   To find out what firmware version you are using.  You can boot into
   your Lenovo BIOS, and check it.  If it says firmware version 1.06,
   then continue.

   Alternatively, in GNU/Linux run this command:

   #+BEGIN_SRC sh
     x86$ grep 'at EC' /proc/asound/cards
   #+END_SRC

   #+RESULTS:
   : ThinkPad Console Audio Control at EC reg 0x30, fw 7WHT19WW-3.6

   7WHT19WW is the version in different notation, use search engine to
   find out regular version - in this case it’s a 1.06 for x200 tablet

   If your EC firmware is outdated, then you can use the Lenovo update
   utility to update your firmware.  There is an option to burn it to
   a disk, and boot it.  This will not work after you install
   libreboot.  /Make sure your update your EC firmware before
   installing libreboot!/

   More information, such as where to get the Lenovo EC firmware
   update utility is available here:

   https://www.thinkwiki.org/wiki/BIOS_update_without_optical_disk

** wiring the beagle bone black (or rasberry pi) and chip together

  ONLY connect the panorama clip to the flash chip while the PI is
  off.  Never connect the clip to the chip after you turned the pi on.

*** Rasberry Pi model B+

    Here is a table that shows you all of the pin Locations on the
    Rasberry Pi B+

   |------+-----+-----+----------------+----+----+---------------|
   |      |     |     | 3v3 Power      |  1 |  2 | 5v Power      |
   |      |     |     | BCM 2 (SDA)    |  3 |  4 | 5v Power      |
   |      |     |     | BCM 3 (SCL)    |  5 |  6 | Ground        |
   | HDMI |     |     | BCM 4 (GPCLK0) |  7 |  8 | BCM 14 (TXD)  |
   |      |     |     | Ground         |  9 | 10 | BCM 15 (RXD)  |
   |      |     |     | BCM 17         | 11 | 12 | BCM 18 (PWM0) |
   |      |     |     | BCM 27         | 13 | 14 | Ground        |
   |      |     |     | BCM 22         | 15 | 16 | BCM 23        |
   |      |     |     | 3v3 Power      | 17 | 18 | BCM 24        |
   |      |     |     | BCM 10 (MOSI)  | 19 | 20 | Ground        |
   |      |     |     | BCM 9 (MISO)   | 21 | 22 | BCM 25        |
   |      |     |     | BCM 11 (SCLK)  | 23 | 24 | BCM 8 (CE0)   |
   |      |     |     | Ground         | 25 | 26 | BCM 7 (CE1)   |
   |      |     |     | BCM 0 (ID_SD)  | 27 | 28 | BCM 1 (ID_SC) |
   |      |     |     | BCM 5          | 29 | 30 | Ground        |
   |      |     |     | BCM 6          | 31 | 32 | BCM 12 (PWM0) |
   |      |     |     | BCM 13 (PWM1)  | 33 | 34 | Ground        |
   |      |     |     | BCM 19 (MISO)  | 35 | 36 | BCM 16        |
   |      |     |     | BCM 26         | 37 | 38 | BCM 20 (MOSI) |
   |      |     |     | Ground         | 39 | 40 | BCM 21 (SCLK) |
   |      |     |     |                |    |    |               |
   |      |     |     |                |    |    |               |
   |      |     |     |                |    |    |               |
   |      | USB | USB |                |    |    |               |
   |------+-----+-----+----------------+----+----+---------------|

  This image is helpful if you have a 16 pin flash chip
  https://libreboot.org/docs/install/images/t400/0065.jpg

  If you are using a 16 pin on a 16 chip flash, then chart should
  prove helpful:

  # https://libreboot.org/docs/install/rpi_setup.html

  |-----+----------+-------------------|
  | pin | SPI pin  | rasberry pi pin # |
  |   1 | not used | not used          |
  |   2 | 3.3V     | 1                 |
  |   3 | not used | not used          |
  |   4 | not used | not used          |
  |   5 | not used | not used          |
  |   6 | not used | not used          |
  |   7 | CS#      | 24                |
  |   8 | S0/S1O1  | 21                |
  |   9 | not used | not used          |
  |  10 | GND      | 25                |
  |  11 | not used | not used          |
  |  12 | not used | not used          |
  |  13 | not used | not used          |
  |  14 | not used | not used          |
  |  15 | S1/SIO0  | 19                |
  |  16 | SCLK     | 23                |
  |-----+----------+-------------------|

** a note on powering the flash chip

   At this point your laptop should be completly disassembled.  Please
   inspect your flash chip to determine which kind you have.  If it
   say "MX", then you have a Macronix chip.  If it says something else
   then you have an SST chip.

   In order to operate, the flash chip needs to be supplied with 3.3V
   power.  Note: The raspberry pi 3.3V rail should be sufficient to
   power the chip during flashing, so no external power supply should
   be required; however, generally SST chips can use the 3.3V from the
   Ii to provide power to the chip, but this does not always work for
   the Macronix chips.  If you have an SST chip, then you should have
   no issues; please skip to the next section. But if you have a
   Macronix chip, please read on.

   While the 3.3V power supply of the pi should be enough in terms of
   voltage to power the Macronix chip, but it may not necessary
   provide enough current for flashing. Perhaps you could power up an
   arduino and use it's 3.3V power supply.  Maybe that will work.  Or
   you could use a shutoff laptop, with the power connector plugged
   in.  In that case, you would need a usb to female wire adater to
   power the Macronix chip.  If that fails, then you may need an
   external PSU (power supply unit) that can provide 3.3V.

** ensure that you have spi devices enabled in the pi

   https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/

   SPI is a communication protocol for microcontrollers.  You need to
   enable it, to reflash your chip.

   #+BEGIN_SRC sh
     pi# sudo raspi-config
   #+END_SRC

   Choose 5 "Interfacing Options"

   Choose P4 SPI "Enable/Disable automatic loading"

   Would you like the SPI interface to be enabled?

   Yes

   Ok

   Reboot now
** testing to see if you can read the chip

   Power on your Pi, and run the following. Ensure you swap out
   “your_chip_name” with the proper name/model of your chip. Check that
   it can be read successfully. If you cannot read the chip and receive
   an error similar to “no EEPROM Detected” then you may want to make
   sure that MISO/MOSI are not swapped around, check with multimeter
   whether voltage is right and that ground is connected between
   “programmer” and target.

   If you do not know what kind of chip you have, then try running
   this command.  The output should show you what type of chip you
   have.  It should also tell you what size of chip that you
   have. 8192 kB is an 8MB chip.  4000 kB or so is a 4MB.

   #+BEGIN_SRC sh
     pi#  ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512
   #+END_SRC

   #+RESULTS
   : flashrom v1.2-14
   : flashrom is free software, get the source at https://flashrom.org
   : Using clock_gettime for delay
   : Found Macronix flash chip "MX25L6405" (8192 kB, SPI) on linux_spi.
   : Found Macronix flash chip "MX25L6405D" (8192 kB, SPI) on linux_spi.
   : Found Macronix flash chip "MX25L6405D" (8192 kB, SPI) on linux_spi.

   :WhatTheOfficialGuideSays:
   Now that you know what kind and what size your chip is run these
   commands to read your flash rom three times.

   These commands are for the SST chip.

   #+BEGIN_SRC sh

     pi#  ./flashrom -p linux_spi:dev=/dev/spidev0.0 -r romread1.rom

     pi#  ./flashrom -p linux_spi:dev=/dev/spidev0.0 -r romread2.rom

     pi#  ./flashrom -p linux_spi:dev=/dev/spidev0.0 -r romread3.rom

   #+END_SRC

   These commands are for the Macronix chip.  You may need to replace
   =-c "MX25L6405D"= with your chip name.

   #+BEGIN_SRC sh
       pi# cd ~/flashrom

       pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -c "MX25L6405D" -r romread1.rom

       pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -c "MX25L6405D" -r romread2.rom

       pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -c "MX25L6405D" -r romread3.rom

   #+END_SRC

   Now that you have read and save the factory rom image 3 times,
   verify that the pi has a good connection.  Check that all files are
   the same.

   #+BEGIN_SRC sh
       pi# sha512sum romread*.rom
   #+END_SRC

   If they are identical sha512 hashes then you can generally assume that
   it’s safe to continue, because flashrom has managed to read the
   flashchip precisely (but not always accurately).
   :END:

   We are almost ready to flash the chip, but we want to make sure
   that we can read the rom's contents reliably and that it has not
   been corrupted.

   We will now run two commands. The first command will read the stock
   proprietary rom image in the chip.  The second will verify that
   what we read is what is in the file, which means that we can
   probably read the flash rom chip reliably.

   These commands are for the SST chip.

   #+BEGIN_SRC sh
      pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -r romread.rom
      pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -v romread.rom
   #+END_SRC

   These commands are for the Macronix chip.  You may need to replace
   =-c "MX25L6405D"= with your chip name.

    #+BEGIN_SRC sh
      pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -c "MX25L6405D" -r romread.rom
      pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -c "MX25L6405D" -v romread.rom
    #+END_SRC

    Now you need to look at the end of stock rom file.  If you see a
    ton of error messages at the end of the rom, then we will need to
    patch flashrom. The strings command will find all strings in the
    binary file, which should give something recognizable.

    #+BEGIN_SRC sh
      strings romread.rom
    #+END_SRC

    Check the end of its output.  You should see some garbled strings at
    the end of its output. Like this:

    #+BEGIN_VERSE
      2ne0
      en22
      esmj
      2@e#
      enn43
    #+END_VERSE

    If instead you see it's filled with output like OxFF/Ox00 [fn:2], then
    you will need to patch flashrom to work with your poor setup.

    You may also check the output with hexedit

    #+BEGIN_SRC sh
    sudo apt-get install hexedit
    hexedit readrom.rom
    #+END_SRC

    Once readrom opens, you need to navigate to the end of the file.
    type Return or Enter.  hexedit will prompt you for a location.  If
    it is an 8MB file type RETURN 0x80000.  If it is an 4MB file type
    0x40000.  Once you are at the end of the file, look for any error
    messages.  The error messages look like "0xFF/0x00".  If you see
    any of those, then you will need to patch flashrom.  C-c will
    close the program.

** getting the rom images and libreboot util

   HTTPS mirrors

   | UK          | https://www.mirrorservice.org/sites/libreboot.org/release/ |
   | USA         | https://mirror.math.princeton.edu/pub/libreboot/           |
   | USA         | https://mirror.splentity.com/libreboot/                    |
   |             | https://mirror.sugol.org/libreboot/                        |
   | Spain       | https://mirrors.qorg11.net/libreboot/                      |
   | Netherlands | https://mirror.koddos.net/libreboot/                       |
   | France      | https://elgrande74.net/libreboot/                          |
   | France      | https://mirror.swordarmor.fr/libreboot/                    |
   | France      | https://mirror.cyberbits.eu/libreboot/                     |
   | Hong Kong   | https://mirror-hk.koddos.net/libreboot/                    |

   Use the 2016 09 07 version.
   https://libreboot.org/docs/gnulinux/grub_cbfs.html
   https://mirror.math.princeton.edu/pub/libreboot/stable/20160907/

   A good rule of thumb is to flash the libreboot rom as is.  Download
   the rom image.  Do not worry about changing the default Mac address
   yet.  You can do that after you reassemble your laptop.

   Download libreboot util:

   All of the following commands ought to be executed on the pi.

   So, now we need to install flash rom, which will let us flash our
   libreboot image.  Then we need to download and unpack the libreboot
   utilities.

   #+BEGIN_SRC sh
     pi# apt-get install flashrom
     pi$ wget https://mirror.math.princeton.edu/pub/libreboot/stable/20160907/libreboot_r20160907_util.tar.xz
     pi$ tar -xf libreboot_r20160907_util.tar.xz
     pi$ mv "libreboot_r20160907_util" "libreboot_util"
   #+END_SRC

   # https://libreboot.org/docs/gnulinux/grub_cbfs.html

   To download the right size rom, you need to know the size of your
   Macronix chip. It can be either 4mb, 8mb, or 16mb.

   If your chip is not 8mb, then change the file so that it says "16mb"
   or "4mb".

   #+BEGIN_SRC sh
     pi$ cd ~/;
     pi$ wget
     pi$ https://mirror.math.princeton.edu/pub/libreboot/stable/20160907/rom/grub/libreboot_r20160907_grub_t400_8mb.tar.xz
     pi$ tar -xf libreboot_grub_r20160907_grub_t400_8mb.tar.gz
     pi$ cd libreboot_grub_r20160907_grub_t400_8mb;
   #+END_SRC

   One you are in this directory look for your preferred keyboard
   layout, and select the roms that say textmode.  Those roms include
   Memtest86+, which you should always run after installing libreboot.

   :IGuessWeAreNotDownloadingLibrebootUtil:

     #mv libreboot_grub_r20160907/t400_8mb_usdvorak_txtmode.rom ~/libreboot_util/ich9deblob/armv71/;
     #cd ~/libreboot_util/ich9deblob/armv71/;
   :END:

** the actual command to flash the chip

   The first command flashes the chip.  The second command verifies
   that what you put on the chip matches the libreboot rom.

   If your chip is an SST, then run this command.
   #+BEGIN_SRC sh
     pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -w /path/to/libreboot.rom
     pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -v /path/to/libreboot.rom
   #+END_SRC

   If your chip is a Macronix, then run this command.
   #+BEGIN_SRC sh
     pi# ./flashrom -c "MX25L6405D" -p linux_spi:dev=/dev/spidev0.0 -w /path/to/libreboot.rom
     pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0 -c "MX25L6405D" -v /path/to/libreboot.rom
   #+END_SRC

   The first command may fail a couple times, but keep trying.  You
   may even see some error messages, but if the command finishes with
   =Verifying flash... Verified= or =Warning: Chip content is
   identical to the requested image= then you’re done.

   The second command should also say finish with something like
   =Verifying flash... Verified=.

   Once you have verified that the command succedded successfully,
   then flash has completed successfully.  Congradulations you have
   just installed libreboot!

   Shut down your pi, put your laptop back together and reboot into memtest.

** On the first boot of libreboot, run memtest!

   You will need to have flashed the libreboot image with txtmode to
   do this.  Memtest[fn:3] only works with txtmode.

   <swiftgeek> also test network before you start changing stuff in gbe region
   <swiftgeek> *wired network  [10:15]
   <swiftgeek> everything should work fine with unmodified libreboot image
                                                                           [10:17]
   <swiftgeek> (besides memtest with 8GiB of ram, which will break on test #7
            block move)  [10:18]

            ** change the mac address in the libreboot rom
   https://libreboot.org/docs/hardware/mac_address.html

   https://libreboot.org/docs/gnulinux/grub_cbfs.html#changeMAC

   <specing> you attach the keyboard as well
   <swiftgeek> if you don't have RTC battery inserted then it will start up by
            itself

   :WhatTheOfficialGuideSays:

   Change MAC address in ROM

   The last step before flashing the new ROM, is to change the MAC
   address inside it. Every libreboot ROM image contains a generic MAC
   address; you want to make sure that your ROM image contains yours, so
   as to not create any problems on your network (say, for example, that
   multiple family members had libreboot computers, and used the same ROM
   image to flash those computers).

   To do this, we will use the =ich9gen= utility, also located in
   libreboot_util.  Luckily, you are already in the folder that provides
   that command!

   Once there, run the following command, making sure to use your own MAC
   address, instead of what’s written below:

   My Mac address is 00:1C:25:9A:37:BA

   #+BEGIN_SRC sh
   $ ./ich9gen --macaddress XX:XX:XX:XX:XX:XX
   #+END_SRC

   Three new files will be created:

   ich9fdgbe_4m.bin: this is for GM45 laptops with the 4MB flash chip.

   ich9fdgbe_8m.bin: this is for GM45 laptops with the 8MB flash chip.

   ich9fdgbe_16m.bin: this is for GM45 laptops with the 16MB flash chip.

   Look for the one that corresponds to the size of your ROM image; for
   example, if your flash chip size is 8mb, you’ll want to use
   ich9fdgbe_8m.bin.

   Now, insert this file (called the descriptor+gbe) into the ROM image, using dd:

   #+BEGIN_SRC
   $ dd if=ich9fdgbe_8m.bin of=libreboot.rom bs=1 count=12k conv=notrunc
   #+END_SRC

   Move libreboot.rom back to the libreboot_util directory:

   #+BEGIN_SRC sh
   $ mv libreboot.rom ~/Downloads/libreboot_util;
   #+END_SRC

   You are finally ready to flash the ROM!
   :END:

   :NotNeededInfo:
Flash Updated ROM Image

The last step of flashing the ROM requires us to change our current working directory to libreboot_util:

#+BEGIN_SRC sh
$ cd ~/Downloads/libreboot_util
#+END_SRC

Now, all we have to do is use the flash script in this directory, with
the update option, using libreboot.rom as the argument:

#+BEGIN_SRC sh
$ sudo ./flash update libreboot.rom
#+END_SRC

Ocassionally, coreboot changes the name of a given board. If flashrom
complains about a board mismatch, but you are sure that you chose the
correct ROM image, then run this alternative command:

#+BEGIN_SRC sh
$ sudo ./flash forceupdate libreboot.rom
#+END_SRC
:END:

** change the mac address in the libreboot rom
   https://libreboot.org/docs/hardware/mac_address.html

   https://libreboot.org/docs/gnulinux/grub_cbfs.html#changeMAC

   FIXME.  This needs to be updated.  Only change the macaddress after
   you have successfully flashed libreboot.  You should change the
   macadress via software methods.  Change the macaddress via
   libreboot software updates after you have reassembled your laptop.

   Change MAC address in ROM

   The last step before flashing the new ROM, is to change the MAC
   address inside it. Every libreboot ROM image contains a generic MAC
   address; you want to make sure that your ROM image contains yours, so
   as to not create any problems on your network (say, for example, that
   multiple family members had libreboot computers, and used the same ROM
   image to flash those computers).

   To do this, we will use the =ich9gen= utility, also located in
   libreboot_util.  Luckily, you are already in the folder that provides
   that command!

   Once there, run the following command, making sure to use your own MAC
   address, instead of what’s written below:

   My Mac address is 00:1C:25:9A:37:BA

   #+BEGIN_SRC sh
   $ ./ich9gen --macaddress XX:XX:XX:XX:XX:XX
   #+END_SRC

   Three new files will be created:

   ich9fdgbe_4m.bin: this is for GM45 laptops with the 4MB flash chip.

   ich9fdgbe_8m.bin: this is for GM45 laptops with the 8MB flash chip.

   ich9fdgbe_16m.bin: this is for GM45 laptops with the 16MB flash chip.

   Look for the one that corresponds to the size of your ROM image; for
   example, if your flash chip size is 8mb, you’ll want to use
   ich9fdgbe_8m.bin.

   Now, insert this file (called the descriptor+gbe) into the ROM image, using dd:

   #+BEGIN_SRC
   $ dd if=ich9fdgbe_8m.bin of=libreboot.rom bs=1 count=12k conv=notrunc
   #+END_SRC

   Move libreboot.rom back to the libreboot_util directory:

   #+BEGIN_SRC sh
   $ mv libreboot.rom ~/Downloads/libreboot_util;
   #+END_SRC

   You are finally ready to flash the ROM!
   :NotNeededInfo:
Flash Updated ROM Image

The last step of flashing the ROM requires us to change our current working directory to libreboot_util:

#+BEGIN_SRC sh
$ cd ~/Downloads/libreboot_util
#+END_SRC

Now, all we have to do is use the flash script in this directory, with
the update option, using libreboot.rom as the argument:

#+BEGIN_SRC sh
$ sudo ./flash update libreboot.rom
#+END_SRC

Ocassionally, coreboot changes the name of a given board. If flashrom
complains about a board mismatch, but you are sure that you chose the
correct ROM image, then run this alternative command:

#+BEGIN_SRC sh
$ sudo ./flash forceupdate libreboot.rom
#+END_SRC
:END:

** I may also need to modify the grub rom.

   I can do this after the flashing of libreboot, or I can do with with the pi.  Either way is fine apparently.

   If I do not modify the grub payload from libreboot, then I will need
   to type in grub commands at every boot, which would be super
   annoying.  :)

*** I could also do some grub hardening
   https://libreboot.org/docs/gnulinux/grub_hardening.html

*** GNU Guix System full disk encrypted
    https://libreboot.org/docs/gnulinux/guix_system.html
** If I have a sim card reader I should remove it permantly.

It has proprietary fireware, so it can track my movements.
** On reboot your internet may fail

   Essentially, when you tear your laptop apart, you may need to take out the
   BIOS battery.  This may really offset your date.  So when you try to connect
   to the internet, your computer will get weird responses.  Your computer may
   be trying to tell the server that the year is 2120, when the year is
   actually 2020.  If that happens, you may not be able to connect.

   #+BEGIN_SRC sh
   date
   #+END_SRC

   #+RESULTS:
   : Thu 4 Jan 2120 07:34:49 PM EDT

   The fix for this is simple.

   #+BEGIN_SRC sh
   date --set "Thu 26 Mar 2020 07:34:00 PM"
   #+END_SRC

   #+RESULTS:

   Now you should be able to connect to the internet super easily.

* also minifree.org is done for

  Minifree was the main developer of libre's commercial site.  It is
  not defunct.  But hopefully libreboot is still being developed?
  https://minifree.org/

* Footnotes

[fn:3] memtest should be run on any computer after you have touched
the ram stick.

[fn:2] 0x00/0xFF is an error message that detects that something has
gone awfully wrong.

[fn:1] The T200 and T400 support DDR3 ram. NOT DDR4 ram.


code:
#+TITLE:losetup Cheatsheat
#+AUTHOR:Joshua Branson
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Get information
~losetup loopdev~

* set up a loop device

# http://bochs.sourceforge.net/doc/docbook/user/loop-device-usage.html
Set up a loop device:

          losetup [-o offset] [--sizelimit size]
                  [-Pr] [--show] -f|loopdev file

Apparently I'm not supposed to use -P and -o together.

This command will tell you which loop device is currently unused.
~# losetup -f~

losetup /dev/loopN hd0.img

Alternatively ~losetup -o 1048576 --find --show hd0.img~ will also set up the loop device.


code:
#+TITLE:Hurd EZ Manual
#+AUTHOR:Joshua Branson
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Introduction
Mach is an operating system kernel.  Windows, OS X, GNU/Linux, and the *BSDs are all popular operating systems.  Each of these has a kernel, which is software that handles resources and schedules processes' computation time with the CPU.  Traditional kernel's, including the kernels that run Windows, GNU/Linux, and the *BSDs, all use monolithic kernels.  These kernels are huge!  Linux for example is 16 millions lines of code at the time of this writing, while a traditional microkernel can be written in under 10,000 lines of code.

A microkernel then is much smaller, easier to maintain, usually is more secure and is a better design.  Mach was designed to be rather minimal, so that it could virtually run 3 or 4 different OSes on top of it, seamlessly to the user.  A variant of Mach is the kernel that runs OS X, but Mach's dream of virtually running various OSes on top of it was never realized.  In fact some of its original design goals were compromised.  While it is much smaller than a traditional monolithic kernel, it does have some unnecessary features in kernel space.

A small caveat.  Mach is not truly a nanokernel or a microkernel for that matter.  Mach is a hybrid kernel, because it's handling of virtual memory is quite large.  https://www.gnu.org/software/hurd/open_issues/user-space_device_drivers.html  Also mach's current way of connecting to the internet, uses drivers that are located in kernel space and not user space.

However, the goal of the Hurd is to have mach manage tasks, memory, and IPC.  Nothing else.
* Mach log
Mach dumps all of its logs into: /var/log/dmesg

So I can always check that file for stuff.
* Vocab
** Ports
*** Port
A port is like a means of communication.  Consider for example that 1 port is like highway 52.  In order for two cities (processes or a process and a user) to communicate messages must be sent on highway 52.  There are many different highways, just like there are many different ports.

Just like highways, ports can only allow so many people to be on them at a time.  The fixed number of people that are allowed to send messages is called the queue.

There is no global reference for all ports.  A thread can only see ports, to which its task gives it access.
*** Port Rights
A port right, is the right to communicate on a port.  This is like having a traveling visa that grants you the right to travel on a particular highway.

The following macros are of type typedef natural_t mach_port_right_t; they may be of use.  They are the individual rights on a port.

- MACH_PORT_RIGHT_RECEIVE
  Only one task can own the receive right for a port.  This right is killed after the message is sent.
- MACH_PORT_RIGHT_SEND
- MACH_PORT_RIGHT_SEND_ONCE
- MACH_PORT_RIGHT_PORT_SET
- MACH_PORT_RIGHT_DEAD_NAME
- MACH_PORT_RIGHT_NUMBER

But on a port, one might have many different point rights.  There are some pre-defined combinations:

|-----------------------------+-------------------------------------------------|
| macro                       | combination                                     |
|-----------------------------+-------------------------------------------------|
| MACH_PORT_TYPE_SEND_RECEIVE | MACH_PORT_TYPE_SEND  and MACH_PORT_TYPE_RECEIVE |
| MACH_PORT_TYPE_SEND_RIGHTS  |                                                 |
| MACH_PORT_TYPE_PORT_RIGHTS  |                                                 |
| MACH_PORT_TYPE_PORT_OR_DEAD |                                                 |
| MACH_PORT_TYPE_ALL_RIGHTS   |                                                 |

*** Task Port
A task port is also a kernel port, and it's a communication highway between a task and the kernel (ie: mach).

This is probably where mach_msg or mach_msg_trap is used to communicate with the kernel.
*** Control Port
This port is a port that lets one manipulate an entity.
*** Port Name
A port name is a uniquely identifying integer, that specifies a port.

The port name can either be
- an integer specify what port
- MACH_PORT_NULL
  no port port rights are available to this process
- MACH_PORT_DEAD
  There was a port associated with this name, but the port has been killed
- A port set name
  This acts like a receiving right, but it allows a process to receive messages from multiple ports.
*** Port Sets
A port set is a collection of ports that can act as multiple ports from which to receive messages.  mach_msg is used to do this.  When the kernel does send a message to a port set, it has no priority is picking a particular port.

I can create and delete port sets as well as query the kernel about port membership.
** Tasks and Threads
*** Tasks
- A task provides a way for a process to execute.  It contains at least 4 ports and a virtual paged address space.
- Contains n number of threads.
- Does not execute anything
- 2 different tasks, do not share any common thing

Task_info () will give you various information about the port.  A task is created with task_create ().  A task is destroyed with task_terminate ();

Each task has 3 special ports assigned to it.

- the kernel port (at least usually).  This is the port that the task can use to request that the kernel do things that the task cannot.
- the port used by a thread to have the kernel do stuff that the thread cannot.
- bootstrap port  This is supposed to be the port that a task has to communicate with another service, but it can be any other thing.

  One of those special ports is an array of registered ports.

The task can set these ports from task_set_special_port () and can get these ports from task_get_special_port ().
*** Threads
- Is one execution element in a task
- Can accesses any element of the task that holds it
- Can execute at the same time as other threads, even the threads within the same task
- Keeps small amount of info for itself.  That way it doesn't cost much to set up the thread
- Computes stuff
- All threads in the same task, share just about everything.
** Microkernel
A small kernel that provides basic operating system functions.
** nano-kernel
A truly small kernel. This is smaller than a microkernel.
** Virtual Address Space
A task owns a virtual address space, which is a region of memory that it is allowed to change/edit/remove at will.  The executing thead/s are allowed to access any address within this space.  In C lingo this can mean referencing a pointer.

Virtual Address Space is one method of allowing programs to have more memory than they actually do.  The virtual memory is mapped to actual memory.

** Processor Sets
A grouping mechanism that allows scheduling of tasks assigned to a processor set.  These also assign threads and tasks.
** Node
Mach does have support for multiprocessing, but it is not mainlined or currently used.  If you connect two processors together to run Mach, then each processor is called a node.  Suppose you connect 2 machines together and each machine has 5 processors, then there are 10 nodes, each with a node ID (integer).  There are 2 mach hosts, which are the two computers.
** Hosts
When you connect 2 mach machines together to form a supercomputer, each machine is called a host.  Each host both runs mach.
** Devices
Mach builds an internal lists of all devices.  When a task wishes to speak with a device (via device master port), mach builds a new port that provides access the device.  Operations on that port then manipulate the device until the port is closed.
** Events
Actions that threads can wait on. After they happen, threads to specific things.
** mach notes
**** IPC primitives
massages  This has a header, which describes the destination and size of the message, and the rest of the message
Ports  is just of collection of messages.  A port is like a post office.
port sets

the IPC primitives let tasks send messages to ports.  Messages sent to a port always arrive in the order they were sent
and were NOT lost.

Only one task can get a message from port Johnny.  Everyone cannot hear from Johny.
But whoever has the port right for Johnny, can give that right to another task in a message
**** make a message
      to use the mach_msg call you need to include the header file mach/port.h and mach/message.h
      mach_message_return_t mach_msg (
* What services Mach provides
** memory management
*** Virtual address
This section is copied from http://kilobug.free.fr/hurd/pres-en/slides/slides.html
- Paging
  - The virtual address space is linear and contiguous
  - Memory is divided in small pages (4K on ia-32)
  - Allows a far better granularity
  - Transparent for programs
- A page can be :
    - Active and mapped into a physical location (green)
    - Disabled, and transferred to side-storage (yellow)
    - Invalid (red)
    - When a program tries to use a non-mapped page, it triggers a `page fault'

[[~/pictures/vm-memory.png]]
**** A paging example
- Principles
   - Mach chooses which page to keep or discard
   - The `pagers' are in user-space
   - When a program faults an IPC is sent to its `pager'

[[~/pictures/vm-memory.png]]

** I/O
** process management
** communication between processes
*** Port communication Example

Suppose service A wants to communicate with another service B to produce result C.  In order to do this, service A sends a message on the port, to which B owns the receive right.

A's message -->   B's Receive Port    -->   B does some stuff

Now B has to send a message back

B sends C -->  A's Receive Port      -->  A Does stuff.
** Ports
A port is a unidirectional channel where a client who requests a service from a server.  Server servers can send messages to the client via 1 port.

If the port represents a resource that the kernel controls, then the receiver is the kernel and this cannot change.  If the port is anything else, then the receiver is the task, and the receiver can change.

A port has a message queue and a list of who has what rights to it.
*** Messages
A message comprises a fixed sized header (mach_msg_header_t), which specifies the port that the message is going to, and, if a reply is wanted, which port the recipient should send a reply.  It also specifies the size of the message and operation code fields.

Data items follow the header (mach_msg_type_t or mach_msg_type_long_t).  The type descriptor specifies the type of data as well a counting the number of data items.

Message queues can be limited in size via mach_port_set_qlimit.
**** Message Transmission
The send operation queues a message to a port.  The caller blocks until the message can be queued, unless one of the follow happen:

- The message was being sent to a send-once right.  Th-eraare always forcible queued.
- The queue was full, but the caller specific MACH_SEND_NOTIFY.  So the receiver of the message is then forced to accept the message, and notify the caller when the message is queued.
- The message was aborted.
- The send operation exceeds its time out value
- The port was destroyed.
*** Port Rights
A can only be accessed via a port right.  All port rights and ports are securely controlled by the kernel.  It is very unlikely that a process can manipulate a port, if they do not have the rights to do so.

There are 3 types of rights:
- receive rights
  1 port has 1 receive right.  Only one task has the receive rights for a specific port
- send rights
  Many tasks can have multiple send rights to numerous ports
- send-once right
  A task can send 1 message to the port, and they the task loses the right to send any more messages to that port.

Rights can be copied/transfered to many different tasks.  Rights can also be forcibly deleted.
*** Port Name Space
Ports have names via the port name space, which is an index to the port name space.  An entry in a port name space can have 4 values:

- MACH_PORT_NULL no associated right
- MACH_PORT_DEAD A right was associated with this port, but the port has died.
- a port right:  a send once, send or receive rights for the port
- a port set name:  A name that acts like a receive right, but allows a task to receive messages from multiple ports.

* booting
grub loads mach, ext2, and ld.so/exec.
Mach starts ext2.
ext2 starts exec.
ext2 execs a few other servers.
ext2 execs init.
From there on, it's just standard UNIX stuff
* compiling mach
https://www.gnu.org/software/hurd/microkernel/mach/gnumach/building.html
* x15  Richard Braun's rewrite of Mach
https://git.sceen.net/rbraun/x15.git
* what I need to read to understand mach
** Kernel Principles
** Kernel Interfaces
** Mach server Writer
This is probably how various hurd libraries were written ie: libtrivfs, libdiskfs, etc.
Those libraries probably use MiG to make it easier to write Mach servers.

Is ext2fs a mach server?  No

ext2fs is running as a user-space process.  A Mach server is running in the kernel space.

Maybe the auth server is a mach server?  Nope.  auth also runs in userspace.


code:
#+TITLE:Magit Cheatsheat
# The next lines says that I can make 10 levels of headlines, and org will treat those headlines as how to structure the book into

# chapters, then sections, then subsections, then sub-sub-sections, etc.
#+OPTIONS: H:10

* Introduction to Magit
Many commands in magit pop up a small buffer prompting you to specify options.  To see the commits for a specific file, in the git status buffer type "l -f <filename>".  Then you will see all of the commits for 1 file! cool!
* Basic commands
You typically start a magit section by running ~magit-status~.  You can stage un-staged with "s".  You can commit those changes with "cc".  You can push those changes with "Pp".

Un-staging commits can be done via "u".
* magit commands in the status buffer

   - ~$~ will add another buffer that shows you the commands magit is commiting

   - ~s~ on a modified file will stage it

   - ~S~ will stage all modified files

   - ~i~ will add the current file to the project’s git ignore

   - ~u~ will unstage the current modified file

   - ~c c~ will commit your staged changes.  Type in a message in the buffer that appears, and then hit ~C-c C-c~ to close the buffer

   - ~P P~ will push your changes

   - ~F F~ will pull your changes

   - =y= will take you to the branch manager

** history commands
- ~l r l~ will allow you to see the commits that make two branches differ.  This happens when branch "master" is behind branch "new feature".  You can see the differences between the two branches and cherrypick them.
- ~a~ will apple the current commit to your current branch.  This allows me to cherry pick changes from one "bug fix" branch to the
  "master" branch.
- ~A~ does the same as above, but it tries to automatically commit the changes if there are no merge conflicts.
- ~v~ will revert the commit.  It will apply the changes made by a commit in reverse.  But you still need to commit the changes.
- ~.~ toggle mark on a commit
- ~C-c u~ unmark marked commits
- ~=~ show the differ between the marked commit and the commit under point
** Branch Manager commands

   - ~k~ will delete the branch under point

   - ~C-u k~ will force delete a branch under point

   - ~c~  will create a new branch

   - ~r~ renames the branch

   - ~T~ on a local branch changes which remote branch it tracks
* magit bisect
Wow!  Super easy way to narrow down to commit that caused an issue!
http://oremacs.com/2014/12/31/keymap-arms-race/
* magit blame
Visit a magit buffer and run ~magit-blame~.  Magit will divide the buffer into regions, and list which region belongs to which git author and in what commit.  It awesome!

M-w saves the hash of the current region to the kill ring.

"n" and "p" move to the next and previous hunks.
* split up a commit with magit

https://www.youtube.com/watch?v=mtliRYQd0j4

Put point on a commit you want to split open:

Rebase  ->  m  modify a commmit

magit-reset (x)   RET head~  RET

This puts head at the position before the commit you want to modify.  And you are free to split the commit.

rebase -> c continue  for complete the action


code:
#+TITLE: Mailing Lists
#+AUTHOR:Joshua Branson
#+OPTIONS: H:10
#+STARTUP: overview

* The Problem

  Many software projects communicate and develop software via public
  email lists (also known as mailing lists) instead of using web
  interfaces like Github.  This usually confuses young developers,
  because they generally prefer a web based workflow (like Github),
  which is often seen as easier to use. However, more seasoned
  developers find web workflows restricting.  Sites like "Github.com"
  force developers to use one, and /only one/ development workflow.
  This can be annoying for developers, who want to help several
  programming projects, because they have to learn how to use a
  "Github" workflow with a "FIXME add another site here".  That is why
  seasoned software developers generally prefer email lists; email
  lists lets developers cultivate their editing workflow.

  Furthermore, web based workflows force the separation of software
  projects in different and sometimes distant compartments, which may
  hamper communication between software projects from different web
  sites. For example, suppose the authors of a popular JavaScript
  library, which is hosted on Github, plan to improve their JavaScript
  library by make a breaking API change.  Usually the authors, will
  gather feedback from other projects that depend on their library,
  before making this API change.  The JavaScript authors begin to
  notify all such projects on Github, "FIXME add another site", "etc",
  which may mean logging into many different web workflows, and filing
  a bug report with each project.  Conversely, when glibc planned on
  making a significant and breaking API change, they just sent an
  email to the glibc mailing list, and CC-ed all the other relevant
  mailing lists.

  Now that the reader has a beginning introduction to the benefits of
  an email software developmental workflow, the reader is also
  probably interested in using such work flows.  To get started,
  consider that software developers' send and receive hundreds of
  emails per day, and developers needed a reliable method to sort
  through these numerous emails.  The answer lies in the email header
  "List-Id".  When a computer user sends an email to a mailing list, a
  program (usually GNU Mailman), on the remote server, adds the email
  header "List-Id".  Then the program forwards the email to the other
  users that are subscribed to the email list.  Developers can then
  filter email via the "List-Id" header, because its content does not
  change; its consistency is guaranteed.

  Please consider teaching your email provider (dismail.de, or
  riseup.net, etc), to filter your mailing list emails into the
  appropriate folder, because your email provider can do this sort of
  filtering much faster and more continuously than your email client.

  However, this is only part of the solution, because mailing list
  users also ought to specify where followup emails should go.  You
  can use the "[[info:message#Mailing Lists][Mail-Follow-up-To"]] for this.  Mail-Followup-to lets the
  poster alert the rest of the mailing lists that follow up emails
  should go to just the /mailing list/ *or* /to the mailing list and
  the poster./ [fn:1]

* Footnotes

[fn:1]  Regretably, the "List-Id", email header cannot do the job of
the "Mail Followup To." Follow ups to mailing list posts that are sent
directly to the poster, do not contain this header.  Only emails that
are sent directly to the mailing list contain the header "List-Id",
because the /only/ mailing list program (usually GNU Mailman) has the
ability to add the "List-Id" header.


code:
#+TITLE: Man Pages Cheatsheet
#+Author: Joshua Branson


code:
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm tcrm1095
mktextfm ecbx1095
mktextfm ecbx1200
mktextfm ectt1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm ectt1095
mktextfm ecbx1200
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm ecbx1095
mktextfm ectt1095
mktextfm ecbx1200
mktextfm ecrm1095
mktextfm ecrm1728
mktextfm ecrm1200
mktextfm ecrm1440
mktextfm ecbx1440
mktextfm ecbx1095
mktextfm ectt1095
mktextfm ecbx1200
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecrm1095
mktextfm ecss1095
mktextfm ecss1095
mktextfm ecss1095
mktextfm ecss1095
mktextfm ecss1095
mktextfm ecrm1095
mktextfm ecrm1095


code:
#+AUTHOR:Joshua Branson
#+TITLE: Mr. Money Moustace
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Mr. Money Moustace

We like in a rich country.  How can we game the system and save money?  I could feed myself on close to a $1 a day, if I ate mostly rice, like a fair amount of the world does.  I could use my bike, instead of my car to go on small errands.  I save 50¢ on every mile by biking as well as saving money on not having to upkeep my car as much.

To calculate a weekly expense compounded over 10 years, multiply by 752.

To calculate a monthly expenses compounded over 10 years, multiply by 173.


code:
#+AUTHOR:Joshua Branson
#+TITLE: Mu4e
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Mu4e

Mu4e is an emacs email client that seems to work pretty swell.  It is a bit of a hassle to install.  If you want to use it, then you probably need to have a gmail account.  If you have a hotmail or a yahoo account, then you will have a harder time using mu4e.

Mu4e does not get your email.  It does not send your email.  Mu4e is a great tool at searching your email.  It's freakishly bizarre at how fast it can scan your email.

** Getting your Email

Mu4e is so fast, because your email is stored locally in a Maildir.  You need to create a local copy of your email.  To do this you can use isync or offlineimap.  Isync is faster and the developer of offlineimap is creating a new tool that will replace offlineimap.  So use isync.
*** isync
Isync is probably the fastest way to create a maildir.  It can be a bit of a pain to set up.  Google might not let you sync your emails by default.  You need to specify that you want gmail to allow "insecure apps" to access your email.
*** offline imap is probably easier
** Installing mu4e
grr.  Good old compiling it manually.
** online documentation

http://www.djcbsoftware.nl/code/mu/mu4e/index.html#SEC_Contents
** mu find "search"
** mu index will update the mu index in the default maildir


code:
#+TITLE:Next
#+AUTHOR:Joshua Branson
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}

* Navigation

C-n & C-p scroll up and down

* Visit links via C-g

* searching  C-l  "s my search query"

* searching in the buffer
C-s s "string"

C-s k clear all the search boxes in the screen

* forward and backward

C-f and C-b

* bookmarks

C-m s bookmark current page
C-m k delete current bookmark
C-m o open bokmark


code:
#+TITLE: Joshua Branson
#+AUTHOR:nextcloud.org
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}

* stuck in maintenance mode when updating?

https://help.nextcloud.com/t/stuck-in-maintenance-mode-when-upgrading/13545

Run this in next cloud's root directory.

sudo -u www-data php occ maintenance:mode --off


code:
#+TITLE:Nginx EZ Cheatsheet
#+AUTHOR: Joshua Branson

* Tweaking the configuration file
** vocab
- simple directive
  =name parameter1 parameter2 parameter3:
- block directive
  A block directive has the syntax of a simple directive, but it surrounds text with two braces "{", "}".
  #+BEGIN_EXAMPLE
  name parameter1 parameter2 {
  # more programming type text goes here
  }
  #+END_EXAMPLE
- context
  A context is a block directive that has a block directive embedded in its braces.

  #+BEGIN_EXAMPLE
  events {
        name parameter1 parameter2 {

        }
  }
  #+END_EXAMPLE

  Any directive not in a context is considered to be in the main context.  The events and http context reside in the main context.  While the server context is in http, and location is in server.

 Nginx can have several server blocks with each block serving content from different websites.  You can also serve different content if a client accesses your site from a specific port.

Events and http reside in the main content.

Server is found in the http context, and location is always in a server context.
** You can have 2 location blocks in one server context

It's possible to have one server block get images from the /var/image/ directory and serve html files from the /usr/share/nginx
directory.

server {
    location / {
        root /usr/share/nginx;
    }

    location /images/ {
        root /var/image/;
    }
}

If a URI matches several location blocks, then nginx will serve the one with the longest prefix.  For example, GET images/pig.jpg matches both location blocks, BUT the second one has the longest prefix, so nginx serves the image from the second directory.
** check your changes for errors

#+BEGIN_SRC sh :results output :exports both
service nginx configtest  && service nginx restart
#+END_SRC
* tutorials for using nginx to serve more than 1 domain name

https://linode.com/docs/web-servers/nginx/how-to-configure-nginx/

https://wiki.archlinux.org/index.php/Nginx#Configuration

https://wiki.archlinux.org/index.php/Network_configuration#Local_network_hostname_resolution

https://wiki.archlinux.org/index.php/Network_configuration#Set_the_hostname

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts

https://serverfault.com/questions/654652/multiple-domains-name-on-one-server-with-nginx/772320
* good online information for nginx
https://www.nginx.com/resources/wiki/start/
https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
https://wiki.debian.org/Nginx/DirectoryStructure
* nginx and https
To configure nginx for https, one should probably just use
certbot.org.  aka let's encrypt by Mozilla.  However, nginx does need
to be able to read the certificates.  At the moment, it looks like it
can, but also any process on my computer can read the certificate.  I
should probably tweak the permissions a bit...
* installing lemp in arch linux
https://www.tecmint.com/install-nginx-php-mysql-with-mariadb-engine-and-phpmyadmin-in-arch-linux/
* optimizing nginx
https://bjornjohansen.no/optimizing-https-nginx
https://www.ssllabs.com/ssltest/analyze.html?d=www.gnusites.com
https://weakdh.org/