Saturday, December 23, 2017

Formatted pdf output with MarkDown, Pandoc, and Latex.

I needed to create a document in a text format that would allow me to build a pdf that can be printed in a nice manner. I chose pandoc and markdown for the primary text file. I've managed to get it looking in the way that I want it, mostly.

The following header in my makdown file setups a twosided document with inner margin of 1.5in and the top, bottom, outer of 1.0in. The H1 and H2 sections (section/subsection) are using a different sized font and are centered on the page. I've needed to do multicolumn layout in a few places so there is a new command that does that for pandoc. The font is set for times and the default size is 12pt. The downside to this is that I've not been able to get the PDF bookmarks to have the correct page numbers yet. This prints nicely though.

I pulled all of this together from a bunch of StackOverflow/StackExchange question/answer.


---
subparagraph: yes
documentclass: article
fontfamily: times
fontsize: 12pt
geometry: twoside, outer=1.0in, inner=1.5in, top=1.0in, bottom=1.0in
header-includes:
 - \usepackage{titlesec}
 - \usepackage{multicol}
 - \usepackage{bookmark}
 - \titleformat*{\section}{\fontsize{16}{20}\filcenter\selectfont}
 - \titleformat*{\subsection}{\fontsize{13}{15}\filcenter\selectfont}
 - \newcommand{\hideFromPandoc}[1]{#1}
     \hideFromPandoc{
       \let\Begin\begin
       \let\End\end
     }
---

\pagenumbering{gobble}

Some text on an intro page

\newpage

   

\pagebreak

\pagenumbering{arabic}

# Begin header of page 1 of the new document

Multicols are done in the following manner. If doing a list use make sure the blank line is there after/before \Begin/\End. They won't format properly otherwise.


\Begin{multicols}{2}

1. Item 1
2. Item 2
3. Item 3
4. Item 4
5. Item 5

\End{multicols}

Here's the makefile that I created to build the document.
output.pdf: input.md
 pandoc -f markdown -t latex -o $@  $^

clean:
 rm -f *.pdf *~


Friday, December 22, 2017

NFS cache cleaning

Running some tests with large datasets mounted via NFS. I'm using using nfsiostat to measure performance on the client. So to see how the server is acting when there's no data in the linux buffer cache, I need to clear them between runs. This Stack Overflow question has the information needed.

Thursday, November 02, 2017

hp-setup Errors

If you ever have problems with your HP network printer and the hp-setup utility under Fedora, make sure that you have SNMP turned on. I had the following error and it was due to me having turned of SNMP. The utility would fail and scanning wouldn't work.

hp-setup error: Unable to communicate with device (code=12)

Monday, April 03, 2017

Using CAC with KVM/QEMU and remote viewer

To use a SmartCard or CAC with kvm/qemu, you'll need to install remote-viewer on the machine that will run remote-viewer to connect to the remote VM. The VM will need the Smartcard hardware installed and set to Passthrough. A CCID controller will be required as well.

The command to connect to the VM with the smartcard is

remote-viewer --spice-smartcard spice://<ip or hostname of VM host>:5900

Sunday, February 26, 2017

Nouveau Fedora Dell 6520

I have a Dell E6520 personal laptop. It's old and I've had problems with the Nouveau and Nvidia GPU. With the update to Fedora 25 and Wayland, I started having more random lockups. I had disabled hardware video acceleration in Chrome, but that wasn't fixing the issue. I finally decided to lookup disabling Wayland and video acceleration. To disable Wayland, edit /etc/gdm/custom.conf:
[daemon]
# Uncoment the line below to force the login screen to use Xorg
WaylandEnable=false
To disable nouveau acceleration, edit /etc/default/grub
GRUB_CMDLINE_LINUX="rhgb quiet nouveau.noaccel=1"
Run the grub2-mkconfig command:
sudo grub2-mkconfig --output="/boot/grub2/grub.cfg

Tuesday, January 24, 2017

Intel AMT Serial Over LAN

Quick post about what I needed to do to get Serial Over Lan (SOL) working on an HP z420 workstation. This machine has a Xeon processor. Sincce there's no integrated graphics, the KVM capaability of Intel vPro/AMT doesn't work. Modify /etc/default/grub and add the following two lines at the end fo the file.
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS4,115200n8"
GRUB_SERIAL_COMMAND="serial --speed=115200 --port=0xe060 --word=8 --parity=no --stop=1"
Create the file /etc/systemd/system/serial-getty@ttyS4.service with the following contents.
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
BindsTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

[Service]
ExecStart=-/sbin/agetty --keep-baud 115200 %I vt100-nav 
Type=idle
Restart=always
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

[Install]
WantedBy=getty.target
Enable the ttyS4 getty in systemctl with command below.
systemctl enable serial-getty@ttyS4.service
Reboot your machine. You should be able to use SOl via the following command. There will be a prompt for the AMT password. This was set in your BIOS.
amtterm host or ip address
Check the status of the getty
systemctl status serial-getty@ttyS4.service

Sunday, January 08, 2017

Opensource Software Waivers and the U.S. Government

Opensource software waivers are a joke. It may take many months or even a year or more to get the software approved. It may only be for a specific version of the software as well. So, when you do get the software approved you may not be able to use the latest with whatever security patches that have been approved. If anything, the process and bureaucracy are making the their organizations more insecure.