Tag Archives: bash

Links: Jun 3

Writing is nature’s way of telling you how sloppy your thinking is.

 Technology:

  • Shocking post-mortem from Joyent: operator mistake and a tool which reboots the whole datacenter without requesting additional confirmation.
  • Defensive BASH programming — an excellent post on scripting techniques!
  • Thinking for programmers by Leslie Lamport. The epigraph comes from this talk.
  • The best expect script I found to execute commands on servers remotely via ssh. This is really handy when one does not have key-based authentication set up. The downside is that it’s slow, so one need to parallelise it if one has over few dozen of servers to crawl.
  • ncf — CFEngine framework for small installations, runs in pure CFEngine language, to help structure your CFEngine policy and provide reusable, single purpose components distributed under the GPLv3 license.
  • The same guys are behind the Rudder — web-driven, role-based solution for IT Infrastructure Automation & Compliance.
  • “Law of Murphy for devops: if thing can able go wrong, is mean is already wrong but you not have Nagios alert of it yet”. Therefore, don’t forget to monitor these things.
  • Interesting stats on monitoring tools — Nagios is the king, Sensu and Zabbix have a large chunk of large deployments.

English:

  • Hilarious story about why programming sucks. Careful and exact observations put in a lively and funny language. It definitely made my day!
  • Quirks with pronunciation of some borrowed words:

    Another word that the British Anglicized from French is harass and its related noun harassment. They shifted the accent to the first syllable, sounding like “harris.” The Americans preferred the French-style second-syllable stress, no doubt further encouraged by the double s. But the British style is becoming more popular with people who don’t want to sound like they’re saying “her ass” — sort of like how the British “urine-us” pronunciation of Uranus, based on the Latin and Greek stress pattern, is sometimes preferred by Americans who don’t like how the American say-it-like-it-looks version sounds like “your anus.”

  • Stop new wordage? Never gonna happen. In defence of unnecessary words.
  • Corporate speak — speaking strategically without a strategy.

As languages go, English is particularly extreme in differentiating between stressed and unstressed syllables; the stressed syllables play a disproportionately big role in making words identifiable, and because unstressed syllables are out of the spotlight, and don’t contribute much to the exact identity of words, it doesn’t really matter exactly what they sound like. For example, some people pronounce the first syllable of believe as /bɪ/, others as /bə/, and in fact it would often be hard to tell exactly which vowel sound is used. Even if you use a different one – if you say, for example, /bʊ/ or /be/ – the identity of the word will be clear; the important thing is to pronounce the stressed second syllable with a clear /iː/ vowel.

— http://www.macmillandictionaryblog.com/schwa-syllables-and-words-in-different-guises-part-1

Other:

The story behind lavabit shut down.




Links: Oct 27

This has been a busy month and, what pleases me, very productive. Apple’s recent announcement managed to surprise in many ways, which is delightful as well; if you’re still on Mountain Lion consider upgrading, Mavericks got it right in so many places, that it’s even difficult to tell which changes are most compelling.

I’ve lagged on links, however, so catching up:

Technology

  • What nohup does:

  • Query against over 1500 global DNS servers

English

Other

  • I’ve finally found where the phrase “With sufficient thrust, pigs fly just fine” comes from! Appears it’s from RFC1925:

(3) With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead.

But references to flying pigs appear even in Lewis Carrol’s Alice:

"Thinking again?" the Duchess asked, with another dig of her sharp little chin.
"I've a right to think," said Alice sharply, for she was beginning to feel a little worried.
"Just about as much right," said the Duchess, "as pigs have to fly...." — Alice's Adventures in Wonderland, Chapter 9.


 

Links: 20 Sep

Technology

Other

> How about a sysctl that does “for the love of kbaek, don’t ever kill these
> processes when OOM. If nothing else can be killed, I’d rather you panic”?

An aircraft company discovered that it was cheaper to fly its planes with less fuel on board. The planes would be lighter and use less fuel and money was saved. On rare occasions however the amount of fuel was insufficient, and the plane would crash. This problem was solved by the engineers of the company by the development of a special OOF (out-of-fuel) mechanism. In emergency cases a passenger was selected and thrown out of the plane. (When necessary, the procedure was repeated.) A large body of theory was developed and many publications were devoted to the problem of properly selecting the victim to be ejected. Should the victim be chosen at random? Or should one choose the heaviest person? Or the oldest? Should passengers pay in order not to be ejected, so that the victim would be the poorest on board? And if for example the heaviest person was chosen, should there be a special exception in case that was the pilot? Should first class passengers be exempted? Now that the OOF mechanism existed, it would be activated every now and then, and eject passengers even when there was no fuel shortage. The engineers are still studying precisely how this malfunction is caused.

Remember measles? That old-timey disease we officially eliminated in the United States 13 years ago? Thanks to the wonder of inoculation, measles should be entirely nonexistent in this country, but yesterday the Center for Disease Control reported 159 cases from January through August of this year.

What’s unique about this year’s outbreak is that the CDC has finally admitted the spread of this “eliminated” disease is based on religious communities’ philosophical aversion to vaccines and reliance on divine healing through the Word of God. According to the report, 91 percent of the reported cases were in people who were unvaccinated, or didn’t know their vaccination status, and “of those who were unvaccinated, 79 percent had philosophical objections to vaccination.”

  • London Heathrow’s glissade timelapse:

 

 

Как запретить интерпретатору bash сохранять некоторые команды в истории команд?

Переменная окружения HISTCONTROL задаёт параметры сохранения команд в истории команд интерпретатора bash.

HISTCONTROL состоит из списка опций, разделённых двоеточием. Опции могут принимать следующие четыре значения:

  • Если список опций содержит ignorespace, то команды, начинающиеся с пробела, сохраняться в истории не будут.
  • Опция ignoredups указывает, что строки совпадающие с последней строкой истории, сохранятся не будут.
  • Опция ignoreboth — сокращение для ignorespace и ignoredups.
  • Опция erasedups говорит интерпретатору, что перед добавлением новой строки в историю команд, нужно удалить все старые строки, совпадающие с добавляемой.

Любое другое значение, кроме указанных, будет игнорироваться.

Если переменная HISTCONTROL не определена, или не содержит допустимого значения, все команды, вводимые в интерпретаторе, будут сохранены в истории команд.

Заметьте, что вторая и последующие строки многострочной команды не проверяются и добавляются в историю команд вне зависимости от значения переменной HISTCONTROL.

Переменная HISTCONTROL может определяться и для конкретного пользователя, и на всю систему, аналогично всем другим переменным окружения интерпретатора bash. Например, чтобы задать опцию ignorespace для всей системы, добавьте следующую строку в файл /etc/bashrc:

export HISTCONTROL=ignorespace

Чтобы задать опцию для конкретного пользователя, укажите необходимую строку в файле .bash_profile в домашнем каталоге пользователя. Обратите внимание, что изменения не будут активизированы до тех пор, пока пользователь полностью не выйдет из интерпретатора и не зайдёт повторно.