Tuesday, July 23, 2013

Bucking the trend...

Well, a few posts back, I promised I would try to fight the ongoing trend in our culture of creeping stupidity, by praising and striving for intellect.  Here you go:

  • http://thelibertarianrepublic.com/watch-a-man-shoot-an-ak-47-underwater/
    Destin over at Smarter Every Day has a new video out showing the slow motion physics of firing an AK-47 under water. His Youtube channel is dedicated to exploring the realm of science through exciting videos educating people about things like how cats flip to their feet and how to identify and handle a brown recluse spider. In this video, he uses slow motion photography to demonstrate to viewers the blast radius of the rifle in his own backyard pool. Enjoy!
    A couple of interesting things here.  First, he had previously tried just plopping an AK-47 into an aquarium, with some — ahem — unfortunate results for the aquarium. So he steps up his game this time: he builds a half-underwater periscope so that the high-speed camera can sit on the pool's deck while he shoots the gun underwater.  Next we're treated to some amazing shots of cavitation, gas flows, details of how an AK-47 works, and finally some interesting explanation as to why the gas cloud's volume oscillates several times before completely collapsing.

    Another awesome aspect to this video: Dustin makes these videos in Alabama. The common stereotype for people from Alabama does not match what you see in this video, nor what I am familiar with from having lived there myself.  Just a little something to consider the next time you're about to make a joke about people in the deep south being their own uncles.
  • https://www.youtube.com/watch?v=tBTy5CNWIHA

    Jamie Mantzel is a crazy guy who lives on a mountain and in his spare time has been building a giant robot for no reason other than that he believes the world will be more awesome with it than without. He's also incredibly smart and his videos are oddly fun to watch. In this installment, he and his friends install a ram pump at his mountain home, and then explain how ram pumps work. He says he gets about a gallon of water per hour delivered to his house, approximately 75 feet above the pump, with no energy source other than a roughly 5 foot drop from his water source.
  • https://www.youtube.com/watch?v=6vroaQjGCkc

    I only learned of this guy the other day - he's got a series of homesteading videos including some interesting bits about grafting apple trees. In this one, he explains how to charge your vehicle's battery by hooking up a chainsaw to the alternator.  Not the most likely of scenarios, but still kinda neat.

Monday, July 22, 2013

Hydraulics...

On Saturday morning, the power take-off (PTO) belt on my John Deere 400 with Front End Loader broke.  I was trying to use the bucket to move some dirt, and all of a sudden the bucket wouldn't lift any longer.  Bummer.

So I climbed off the tractor, and took a look at the engine.  Sure enough, there was a belt hanging out of the side of the engine compartment.  So I pulled the belt out and went over to AutoZone to buy a replacement.

After some cajoling, I managed to get my son to spend some time with me on Sunday morning replacing that belt.  That turned out to be, well, not complex, but surprisingly difficult due to placement and general griminess of all of the bolts in question.  Here was the process:

  1. Unbolt the hydraulic pump, set it on the ground.
  2. Unbolt and remove the hydraulic pump mounting bracket.
  3. Unbolt the lower PTO pulley cover.
  4. Wrap belt around lower PTO pulley and the crankshaft pully
  5. Replace lower PTO pulley cover.
  6. Replace hydraulic pump mounting bracket, but leave bolts a little loosey-goosey
  7. Replace hydraulic pump.
  8. Tighten hydraulic pump mounting bracket bolts.
Sadly, after doing all of this, and exhausting probably a half gallon of Fast Orange in a futile attempt to keep my hands clean, the hydraulic system still doesn't work.  I'm not sure why.  So now I get the unbridled joy of troubleshooting a system for which I have no documentation and little understanding. Time for learning - yay :-/

UPDATE: it turns out the PTO couples to the hydraulic pump by way of a sheer pin, which was apparently broken at the same time as the PTO belt. I've become quite accustomed to manufacturing replacement sheer pins from 16 penny nails, and even more accustomed to knowing how much throttle to give the engine to avoid breaking said nails.

Thursday, July 11, 2013

PHP Log files that don't suck.

From here:

sudo tail -f {path-to-log-file} | perl -pe 's/\[error\]\s+\[client.*?\]\s+//; s/, referer:.*//'

Tuesday, July 9, 2013

You're too smart!

Today I learned of a story dating from 2000, where Robert Jordan was rejected in his bid to become a police officer in New London, CT.  Why was he rejected? It wasn't because he couldn't complete the physical.  Nor was it because he couldn't master police procedure, learn the laws.  It wasn't because he was black, white, asian, or hispanic.  No - it was because his IQ is too high.

That's right.  He's too damned smart to be a cop.

Because if there's one thing you want in your police force, it's a healthy level of stupidity.  What could possibly account for a policy this — stupid?

"But New London police interviewed only candidates who scored 20 to 27, on the theory that those who scored too high could get bored with police work and leave soon after undergoing costly training."

Ah - so smart people can't maintain interest in police work. They couldn't possibly want to grow into a role like, say, detective, where having the ability to piece together clues and solve puzzles might come in handy.  No - they'll just get bored and move on.

All of this reminds me of the short story Examination Day, wherein a young boy takes a standardized test and performs too well for bureaucratic comfort. Unlike Mr Jordan, he didn't merely lose a job opportunity; he was simply killed.

Our culture is sick right now.  We are exposed more to crappy tabloid plots than to smart, amazing people.  I'm not sure how to reverse the trend, other than to point it out and to contribute to the alternative trend of praising and striving for intellect.  I pledge to try.  Please join me.

Examination Day by Henry Slesar

source

Examination Day

The Jordans never spoke of the exam, not until their son, Dickie, was twelve years old. It was on his birthday that Mrs Jordan first mentioned the subject in his presence, and the anxious manner of her speech caused her husband to answer sharply.
‘Forget about it,’ he said. ‘He’ll do all right.’
They were at breakfast table, and the boy looked up from his plate curiously. He was an alert-eyed youngster with flat blond hair and a quick, nervous manner. He didn’t understand what the sudden tension was about, but he did know that today was his birthday, and he wanted harmony above all. Somewhere in the little apartment there were wrapped, beribboned packages waiting to be opened, and in the tiny wall-kitchen something warm and sweet was being prepared in the automatic stove. He wanted the day to be happy, and the moistness of his mother’s eyes, the scowl on his father’s face, spoiled the mood of fluttering expectation with which he had greeted the morning.
‘What exam?’ he asked.
His mother looked at the tablecloth. ‘It’s just a sort of Government Intelligence test they give children at the age of twelve. You’ll be taking it next week. It’s nothing to worry about.’
‘You mean a test like in school?’
‘Something like that,’ his father said, getting up from the table. ‘Go and read your comics, Dickie.’ The boy rose and wandered towards that part of the living room which had been ‘his’ corner since infancy. He fingered the topmost comic of the stack, but seemed uninterested in the colour­ful squares of fast-paced action. He wandered towards the window, and peered gloomily at the veil of mist that shrouded the glass.
‘Why did it have to rain today?’ he said. ‘Why couldn’t it rain tomorrow?’
His father, now slumped into an armchair with the Gov­ernment newspaper rattled the sheets in vexation. ‘Because it just did, that’s all. Rain makes the grass grow.’
‘Why, Dad?’
‘Because it does, that’s all.’
Dickie puckered his brow. ‘What makes it green, though? The grass?’
‘Nobody knows,’ his father snapped, then immediately regretted his abruptness.
Later in the day, it was birthday time again. His mother beamed as she handed over the gaily-coloured packages, and even his father managed a grin and a rumple-of-the-­hair. He kissed his mother and shook hands gravely with his father. Then the birthday cake was brought forth, and the ceremonies concluded.
An hour later, seated by the window, he watched the sun force its way between the clouds.
‘Dad,’ he said, ‘how far away is the sun?’
‘Five thousand miles,’ his father said.

Dickie sat at the breakfast table and again saw moisture in his mother’s eyes. He didn’t connect her tears with the exam until his father suddenly brought the subject to light again.
‘Well, Dickie,’ he said, with a manly frown, ‘you’ve got an appointment today.’
‘I know Dad. I hope –’
‘Now, it’s nothing to worry about. Thousands of children take this test every day. The Government wants to know how smart you are, Dickie. That’s all there is to it.’
‘I get good marks in school,’ he said hesitantly.
‘This is different. This is a – special kind of test. They give you this stuff to drink, you see, and then you go into a room where there’s a sort of machine –‘
‘What stuff to drink?’ Dickie said.
‘It’s nothing. It tastes like peppermint. It’s just to make sure you answer the questions truthfully. Not that the Gov­ernment thinks you won’t tell the truth, but it makes sure.’
Dickie’s face showed puzzlement, and a touch of fright. He looked at his mother, and she composed her face into a misty smile.
‘Everything will be all right,’ she said.
‘Of course it will,’ his father agreed. ‘You’re a good boy, Dickie; you’ll make out fine. Then we’ll come home and celebrate. All right?’
‘Yes sir,’ Dickie said.

They entered the Government Educational Building fifteen minutes before the appointed hour. They crossed the mar­ble floors of the great pillared lobby, passed beneath an archway and entered an automatic lift that brought them to the fourth floor.
There was a young man wearing an insignia-less tunic, seated at a polished desk in front of Room 404. He held a clipboard in his hand, and he checked the list down to the Js and permitted the Jordans to enter.
The room was as cold and official as a courtroom, with long benches flanking metal tables. There were several fathers and sons already there, and a thin-lipped woman with cropped black hair was passing out sheets of paper.
Mr Jordan filled out the form, and returned it to the clerk. Then he told Dickie: ‘It won’t be long now. When they call your name, you just go through the doorway at the end of the room.’ He indicated the portal with his finger.
A concealed loudspeaker crackled and called off the first name. Dickie saw a boy leave his father’s side reluctantly and walk slowly towards the door.
At five minutes to eleven, they called the name of Jordan.
‘Good luck, son,’ his father said, without looking at him. ‘I’ll call for you when the test is over.’
Dickie walked to the door and turned the knob. The room inside was dim, and he could barely make out the features of the grey-tunicked attendant who greeted him.
‘Sit down,’ the man said softly. He indicated a high stool beside his desk. ‘Your name’s Richard Jordan?’
‘Yes, sir.’
‘Your classification number is 600-115. Drink this, Richard.’
He lifted a plastic cup from the desk and handed it to the boy. The liquid inside had the consistency of buttermilk, tasted only vaguely of the promised peppermint. Dickie downed it, and handed the man the empty cup.
He sat in silence, feeling drowsy, while the man wrote busily on a sheet of paper. Then the attendant looked at his watch, and rose to stand only inches from Dickie’s face. He unclipped a penlike object from the pocket of his tunic, and flashed a tiny light into the boy’s eyes.
‘All right,’ he said. ‘Come with me, Richard.’
He led Dickie to the end of the room, where a single wooden armchair faced a multi-dialled computing machine. There was a microphone on the left arm of the chair, and when the boy sat down, he found its pinpoint head conve­niently at his mouth.
‘Now just relax, Richard. You’ll be asked some ques­tions, and you think them over carefully. Then give your answers into the microphone. The machine will take care of the rest.’
‘Yes, sir.’
‘I’ll leave you alone now. Whenever you want to start, just say “ready” into the microphone.’
‘Yes, sir.’
The man squeezed his shoulder, and left.
Dickie said, ‘Ready.’
Lights appeared on the machine, and a mechanism whirred. A voice said: ‘Complete this sequence. One, four, seven, ten . .

Mr and Mrs Jordan were in the living room, not speaking, not even speculating.
It was almost four o’clock when the telephone rang. The woman tried to reach it first, but her husband was quicker.
‘Mr Jordan?’
The voice was clipped: a brisk, official voice.
‘Yes, speaking.’
‘This is the Government Educational Service. Your son, Richard M Jordan, Classification 600-115 has completed the Government examination. We regret to inform you that his intelligence quotient is above the Government regula­tion, according to Rule 84 Section 5 of the New Code.’
Across the room, the woman cried out, knowing nothing except the emotion she read on her husband’s face.
‘You may specify by telephone,’ the voice droned on, ‘whether you wish his body interred by the Government, or would you prefer a private burial place? The fee for Gov­ernment burial is ten dollars.’

Friday, July 5, 2013

Understanding df and LVM in Linux

df is a utility that tells you available space on mounted filesystems.  If you use the "-h" option, it will format the numbers in human readable format.
 
# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root   50G  1.4G   46G   3% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  636K  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                    1.9G  1.9G     0 100% /tmp
/dev/sda1                477M   78M  374M  18% /boot
/dev/mapper/fedora-home  864G   72M  820G   1% /home



So what we have here is a list of filesystem volumes, how much space they have, and where they're mounted.

The /dev/mapper/ prefix indicates that the specified filesystem is an LVM volume. In this case, there are two: /dev/mapper/fedora-root and /dev/mapper/fedora-home. Since this computer has a single hard drive, these are likely sliced out of /dev/sda2. Linux does this so that you can, in theory at least, expand /dev/mapper/fedora-root or /dev/mapper/fedora-home, at will.

/dev/sda1 is the boot partition - that's where you GRUB is located - that's the thing that the BIOS boots and which in turn boots Linux (or other OS's in a multi-boot configuration).

/dev/sda2 is not mounted at all, because it is formatted to be part of a LVM set.  In theory, when you want to expand /dev/mapper/*, you add another hard drive, put it into the LVM set, and expand /dev/mapper/*.


Wednesday, July 3, 2013

Set Fedora 18 to boot to text console rather than X

From here:

ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 
 
 

Set up password-free ssh

From here:

ssh-keygen -t rsa (No passphrase or whatnot - just enter your way through)
ssh {user}@{remote-host} mkdir -p .ssh 
cat .ssh/id_rsa.pub | ssh {user}@{remote-host} 'cat >> .ssh/authorized_keys'
ssh {user}@{remote-host} hostname (should work now)

Set hostname in Fedora 18

From here:

hostnamectl set-hostname {name}

hostnamectl status 

Install NFS on Fedora 18

From here:

yum -y install nfs-utils

edit /etc/exports

systemctl start rpcbind.service
systemctl start nfs-server.service
systemctl start nfs-lock.service
systemctl start nfs-idmap.service
systemctl enable rpcbind.service
systemctl enable nfs-server.service
systemctl enable nfs-lock.service
systemctl enable nfs-idmap.service


Additional crap:

Firewall (from here):

# Enable NFS server

systemctl enable nfs-lock.service
systemctl enable nfs-server.service

systemctl start  nfs-lock.service
systemctl start  nfs-server.service

cat >/etc/firewalld/services/mountd.xml <<EOD<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>mountd</short>
  <description>Mount Lock Daemon</description>
  <port protocol="tcp" port="20048"/>
  <port protocol="udp" port="20048"/>
</service>
EOD

cat >/etc/firewalld/services/rpc-bind.xml <<EOD<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>rpc-bind</short>
  <description>Remote Procedure Call Bind</description>
  <port protocol="tcp" port="111"/>
  <port protocol="udp" port="111"/>
</service>
EOD

restorecon /etc/firewalld/services

firewall-cmd --permanent --zone public --add-service mountd
firewall-cmd --permanent --zone public --add-service rpc-bind
firewall-cmd --permanent --zone public --add-service nfs
firewall-cmd --reload
firewall-cmd --list-all