Home > misc > Linux system info with inxi

Linux system info with inxi

Fri Dec 15 2017 01:00:00 GMT+0100 (Central European Standard Time)

Quickly to remind my future-self: Use inxi to gather system info. Install via 'wget -Nc smxi.org/inxi && chmod +x inxi' and run with './inxi -F'.

Apple devices (MacBook Pro) and 5 GHz WiFi access points (Ubiquiti NanoStation)

Thu May 19 2016 02:00:00 GMT+0200 (Central European Summer Time)

Deploying 5 GHz NanoStations as 'end-user access points' always gave some 'hiccups' with various Apple MacBooks. Usually they could see the signal, but were never able to connect to it. Finally with these settings they hooked up:

  • Disable airMAX
  • Set Country code to US
  • Channel width 20 MHz
  • Frequency 5785 MHz
  • Wifi security WPA2-AES

I simply assume that not all of these settings are required, but I'm simply too lazy to see which ones are required and which ones are optional.

Migrate Windows (XP) guests from VMware Fusion to Virtual Box

Mon Jan 04 2016 01:00:00 GMT+0100 (Central European Standard Time)

Kind of outdated toolset, but just that I don't forget it...

I still had some old VMware Fusion 6.0.6 virtual machines laying around on my Mac OS X 10.9.5. As I was recently using more advanced Virtual Box features, I decided to unify all virtual machine instances with Virtual Box. Turned out this is straight forward, if only you know what you do!

  1. First of all delete unneeded snapshots as they couldn't be migrated anyways.
  2. Then uninstall the VMware Tools (Guest additions).
  3. Get Disk2VHD from Microsoft Technet
  4. Export the VHD image with disabled VHDx from within the VM you want to migrate
  5. Create a new Virtual Box instance, instead of creating a new disk attach the VHD file as harddisk
  6. Enable IO-APIC
  7. Start up the VM and install Virtual Box guest additions

That's it.

Gboard: Arduino-compatible board with integrated GSM/GPRS

Mon Feb 11 2013 01:00:00 GMT+0100 (Central European Standard Time)

With my recent work (aka pet project) on embedded systems mainly based on Arduino I finally came across an Arduino board with built-in GSM/GPRS connectivity. Getting an Arduino with an GSM/GPRS shield is pretty straight forward, but if the device is meant to be strong and durable, these shields don't feel good.

Itead's Gboard does. And it is also pretty cheap; definitely cheaper than e.g. the ordinary Arduino Uno with a GSM/GPRS shield from Seeedstudio.

However. The Gboard is "Arduino-compatible" and as such I was expecting a few hiccups to get it up and running. And as usual a few turns quickly into a lot. So let's have a look.

Jumpers

Like most communication boards the GSM chips is connected through a serial port. But the Gboard just like the Arduino Uno only has one. And this one is also used for programming purpose. In order to use both programming and GSM connection, make sure jumpers are set to ST-D2 and SR-D3 ('Software UART to SIM900, Hardware UART to Specific').

Programming connection

Just like the Arduino Ethernet board (and others) the Gboard doesn't have its own USB connection. So a 'FTDI-style basic USB-to-serial board' is required. But unfortunately the ones from Adafruit or Sparkfun don't work out of the box. First you need to be careful as the boards from Arduino itself require 5 Volts. But the FTDI connection on the Gboard only takes 3.3 Volts. Don't mix this up! Additionally the wires aren't compatible. It seems best to spend the few additional dollars to get the dedicated FOCA board from Itead. But of course this removes the fun of tinkering and I wanted to reuse my existing programming board. Connecting GND, DTR, TX, and RX with dedicated wires does the trick (I had to swap the TX and RX connections). In order to power up the board either a 3.3V connection is required, or simply remove the VCC connection at all and power the Gboard through an external power supply.

External power source

If you need to test the GSM features, make sure you have an external power source connected. Just because the lights go on with a FTDI connection doesn't make the GSM chip work.

Digital ports

The connections of the Gboard differ quite a bit from the default Arduino layout. In particular the board doesn't list any digital ports; just connections labeled with A0 to A7. But in the Arduino world the first 6 analog ports can be used as digital ones as well. Address them by starting from digital pin 14 for A0. The interface on the Arduino is called 'Electronic brick interface' and it seems to be used in other boards as well. So there are pre-made 3 pin connections with sensors available. But as long as you connect +, -, and Signal in the proper way, most other sensors will work too.

Arduino IDE

I assume other options might work as well, but for me the board 'Arduino Duemilanove w/ ATmega328' and Programmer 'Arduino as ISP' did the trick. Sometimes an upload to the board fails, but most often a single repeat will be successful.

If it still doesn't work, consider this trick by pressing the Arduino RST button at the right point in time.

GSM/GPRS features

Finally there is a dedicated lib to ease the use of the GSM chip. I assume sending AT command straight to the soft serial port will work as well, but I haven't tried it. But even though the lib claims it is compatible with the Arduino 1.x IDE, it didn't work in my environment. I had to do a couple of tweaks to the lib (but I don't remember every single step). Steps like removing newsoftserial from lib folder and adding '#include' in GSM_Shield.cpp.

Driver hiccups

Sometimes, especially under Windows it seems as if the wrong drivers are taken for the FTDI communication. Check here to see get an idea of the correct ones. Note that installing the correct driver might fail as a wrong one is somehow blocking it. Follow FTDIs uninstall instructions and try re-installing the driver again.

WTF Apple?

Wed Jan 23 2013 01:00:00 GMT+0100 (Central European Standard Time)

So langsam reicht es. Die Apfel-Logo Company scheint wirklich alles falsch zu machen. Wie um alles in der Welt kann man dann immer noch so erfolgreich sein?

Nach ein paar Jahren nun erneut ein herantasten an die Apps Entwicklung. Ein erster Versuch ist schon damals mit einem der ersten iPod Touchs misslungen. Dabei schrie der standardmäßige gähnend leere Startscreen mit nur 4 oder 5 Icons in dem 4x4 Raster geradezu danach, mit eigenen Apps ge-pimpt zu werden. Aber ne, damals wollte Apple nicht mal nen SDK rausbringen. Dann gab es das, aber bloss für MacOS. Seitdem haben sich noch ein MacBook sowie ein iPad 2 Zeit im Haus angesammelt. Und kürzlich bestand sogar die Chance, beruflich einen Protoypen auf iOS zu platzieren.

Also frisch ans Werk. Eigentlich braucht es ja nur Xcode und schon geht's os. Ach ne, ich vergass. Mein MacOS 10.6 wird nicht mehr unterstützt von der aktuellen Xcode Version. Also müsste ich erstmal MacOS aktualisieren. Keine 3 Jahre alt, schon unbrauchbar: What the fuck?

Aber selbst wenn das erfolgt, dann ist mein iPod schon Elektronik-Schrott. Denn der wird schon lange nicht mehr unterstützt. Dabei fiel mir auf, dass einige 3rd Party Apps Apps, die noch auf dem iPod waren, meinten ein dringendes Update einspielen zu müssen. Ohne das würden diese nicht mehr funktionieren. Doch der App Store meinte nur noch, dass iOS erstmal aktualisiert werden müsse, dies aber leider nicht mehr geht. Also: keine 4 Jahres altes Gerät - nicht mehr zu gebrauchen und auch nicht mehr selbst zu entwicklen. What the fuck.

Kein Wunder, dass die Äpfel-Männer so viel Geld haben. Wenn immer alle willenlos und megageil auf das 'nächste Ding' warten. Und dabei bevorzugt um Mitternacht Schlangen bilden und ihr Geld auszugeben. Die ersten ausgemusterten iPhones wurden schon hinterm Busch in Afrika gesichtet. Die Elektronik-Müllhalden von heute werden nix gegen die iPhone- und iPad-Berge der nächsten Jahre. Natürlich hilft es, dass wir die nicht direkt vor *unserer* Haustür sehen und zerlegt sehen müssen. What the fuck!

Scheiße! Wacht auf und hört endlich auf, so geile Geräte zu bauen die nicht immer alle kaufen müssen!

Create static HTML pages from a local Wordpress installation

Tue Nov 13 2012 01:00:00 GMT+0100 (Central European Standard Time)

Wordpress is convenient when setting up a little web site / blog. You might even think about self-hosting instead of using the services from wordpress.com.

Doing so is easy, but also eats up resources on your system and even worse, opens the door of security holes. You need to think about a lot of things like file permissions, database access, web server config, the PHP subsystem. And of course Wordpress itself. So you need to update often. Over and over again.

If you are like me, then you don't. But always feel bad and that you should do something about it.

If you depend on many Wordpress plugins, then move on. This isn't for you. But if not, then why not setting up a local installation and simply fetch the static HTML pages generated by Wordpress and deploy them on a brain-dead simple static HTTP server?

Of course with this you remove all the dynamics of your system. I think comments could easily moved to an external service like disqus.com. And as I don't really like all these fancy widget changing content automatically all over, I see this purification as another advantage.

To jump-start your local installation, the wonders of virtualization came in handy for me. Among others TurnKey Linux provided a recent version of Wordpress running on a stripped down Linux. Deploying this to a virtual machine of your choice, migrating your old data from the live Wordpress over to the Turnkey installation is all you need.

Afterwards you can work completely locally on your Wordpress content and setup. Then simply invoke a script similar to the one below to automatize the update of your production system. And voila, you have a static mirror of your Wordpress content for free.

As a nice benefit you already get a local backup of your content in your virtual machine.

#!/bin/bash 
# mirrors and uploads a wordpress blog to a static web site 
# check http://x-ian.net for details

# my configs 
LOCAL_WORDPRESS=192.168.6.129 
REMOTE_WORDPRESS=x-ian.net SSH_LOGIN=<your ssh credentials> 
REMOTE_HTTP_DIR=x-ian.net

# preparation 
cd /tmp rm -rf wordpress_mirror 
mkdir wordpress_mirror 
cd wordpress_mirror

# mirror of whole wordpress installation in static html pages 
wget --mirror -R xmlrpc.php,trackback http://$LOCAL_WORDPRESS

# replace remaining links with real server 
find ./$LOCAL_WORDPRESS -type f -exec sed -i "" "s/`echo $LOCAL_WORDPRESS`/`echo $REMOTE_WORDPRESS`/g" {} ;

# upload static html pages 
cd $LOCAL_WORDPRESS 
tar czf ../wordpress_mirror.tgz . 
scp ../wordpress_mirror.tgz $SSH_LOGIN: ssh $SSH_LOGIN "rm -rf x-ian.net; mkdir x-ian.net; cd x-ian.net; tar xzf ../wordpress_mirror.tgz"

# cleanup 
rm -rf /tmp/wordpress_mirror* 
ssh $SSH_LOGIN "rm wordpress_mirror.tgz"

APZUnet - Probably the biggest public WiFi hotspot in Malawi

Tue Nov 13 2012 01:00:00 GMT+0100 (Central European Standard Time)

For Abwenzi Pa Za Umoyo (APZU), Partners In Health' sister organization in Malawi, technology is playing its role in delivering health services and improving communities. IT services like access to computers and especially communication gets more important. Even (or especially) in rural places like the south-eastern District of Neno.

As one basic principle everybody gets access to the network - either government, APZU employees and to some extend private people. Of course this has the downside of potentially hurting commercial Internet cafes as many people throughout Neno Boma get Internet access for free. But a (relatively) fast and working Internet has a number of impacts on the work. Medical research, easy communication, and heck, sometimes it simply entertains...

Over the past few years the communication needs were growing rapidly. We have tried multiple approaches for the local network and the Internet connectivity and went through a couple of design generations. Usually just to realize that the reality was outgrowing our solution.

With the current network in Neno we are probably running the biggest public WiFi hotspot in Malawi. With a coverage of a half square mile and up to 120 unique systems utilizing the network on average.

Currently the system combines a couple of freely available software components together with carefully selected, inexpensive commodity hardware and 1.5 local engineers to keep everything up and running. As we have gained quite a bit of experience we feel that the current system will scale-up even beyond our expectations for the next 2 or 3 years. But TIA, you never know what's coming next.

Putting down all the details is a little bit too much for this post, so I only provide stuff for the buzzword bingo. Get in touch if you want to learn more about it:

  • Traffic accounting
  • User management
  • Local caching (among others esp. for Windows Updates)
  • Segmented network
  • Content filtering
  • Real-time monitoring
  • Bandwidth management

Of course such a system still costs money, but it seems well worth the price if the system is designed carefully. And as most of the components are free and the hardware costs are minimal, it basically comes down to the costs for the sat link (granted still fricking expensive in rural Africa) and your expertise.

How to print a book from a wordpress blog

Mon Nov 12 2012 01:00:00 GMT+0100 (Central European Standard Time)

Even in our digital world you might want to convert your wordpress blog into a paper book. Of course there are services available claiming to do so. But the ones I found didn’t match my specific requirements of

  • Minor content tweaks
  • Custom formatting
  • Inline comments
  • High resolution pictures for offline processing
  • Picture captions and mouse-over labels
  • DIY attitude

So after a lot of trial & error, I found out that I can

  1. export the wordpress content as XML,
  2. create a single page HTML file with all content locally,
  3. automatically tweak some styles,
  4. import the HTML into Word,
  5. re-format as needed,
  6. save as PDF and optionally create an eBook version.

If you want to follow my steps, you need these tools (highly ‚personalized’ and quite a bit developer-driven – it might not be the right process for you).

Export the wordpress content as XML Easily done through your Wordpress Dashboard.

Create a single page HTML file with all content locally Run the attached Ruby script to convert the WXR file into a single page HTML document. This is where most of the magic happens and also the most fragile part. The script is aligned to the elements I typically on my blogs and it might differ from others. But with a little bit f Ruby knowledge it shouldn't be too hard to tune this. Basically it takes the XML file, filters for the posted and published stories, tags the various elements with different HTML classes and has some processing around images to include captions and mouse-over titles. It returns the HTML on the console, so best is to invoke it like this: wordpress_to_single_html.rb 'your wordpress export' > single_html.html

Now the pictures are still on the wordpress server. Use Firefox to open the HTML and save it again with the option 'website complete' to have everything on your system (incl. pictures) for faster offline access.

Finally open the newly saved HTML file in a text editor and search&replace all relative img URLs with absolute paths (e.g. substitute 'myblog_files/ with file:///c/myblog_files/. This is sadly required for the Word import.

import the HTML into Word & reformat styles After opening/importing the HTML in Microsoft Word you can modify styles and ‚pimp’ the content as you want. Check for styles beginning with an _ created by the Ruby script to mark different elements of the blog (content, headings, comments, post_date, ...). Save as docx for future needs (and always keep the images folder with the docx).

save as PDF and optionally create an eBook version. Most print on demand services take a PDF, so simply save your document as a PDF. If you want to create an eBook version as well it you enter the ‚format hell’ for eBook content. Calibre seems to understand most formats and can also load the HTML export from Word to e.g. create a version in the epub format. (More general info about ebooks.)

That's all. Isn't it simple?

Note about Apple Pages: Using Apple Pages seems the more obivous choice for text processing on a Mac. However the recent Pages versions removed the HTML import. So there wasn’t an easy way to get the wordpress content nicely formatted into Pages. Two workarounds are available: One ist to simply copy&paste content from the safari and the other is to use TextEdit (which still has a HTML import) to create a RTFD (RTF including attachents) and then load it into Apges. Unfortunately all pictures are scaled up tot he full page and this makes it painful if you have plenty of pictures embedded.

Note about Microsoft Word for Mac: It turned out that my mac version had multiple hiccups with a few hundred pages of text and plenty of included pictures. Switching to Windows made it less stressful for me.

Note about Microsoft Word: Seems plain wrong to me that recent versions of Word have problems with images you want to link in. My impression is that if you include a picture via a link to an external file, Word creates an absolute file path reference to this. Of course this makes it impossible to move the document and files around – even on your own local system. And when trying to embed to files right into the docx (which of course can seriously bloat the file size up), at least form e many pictures changed the scaling. Some oft hem were even uglily transformed.

Gmail and IMAP - an odd couple: How gmail plays nicely with IMAP

Sat Nov 03 2012 01:00:00 GMT+0100 (Central European Standard Time)

Lots has been written about it. There is even an official guideline provided by Google. Many different ways to use it, but fact is that the default config is bloody useless. Partially because IMAP only knows hierarchical folders and gmail has labels, partially because IMAP has a few underspecified parts.

Here are my 2 cents of hands-on configuration for IMAP clients like Apple Mail or Microsoft Outlook:

  • If you are on a mobile devices, use ActiveSync/Exchange connectivity. [Reason: increase your lifetime by reducing blood pressure]
  • Modify Labels in gmail via Settings. Deactivate 'Show in IMAP' at least for 'All mail', maybe also for 'Starred', 'Important', 'Chat' [Reason: Mails can be tagged with multiple labels and therefore show up in every folder derived from the labels. Hence a message tagged with more than one label will be duplicated in these folders.]
  • For custom labels use '[Gmail]/ as a prefix [Reason: This way they will show up underneath the Default folder path [Gmail] in your mail client.]
  • Consider deactivating 'store draft messages on server' [Reason: depending on your network this can slow down and eat up bandwidth together. Additionally it might happen that mails currently drafted and saved multiple times will show up as deleted mails whenever the auto save on the client happens.
  • Store sent messages on the server, Store junk messages on the server, and Move deleted messages to the Trash mailbox [Reason: keep these folders in sync with your gmail UI or other mail clients.]
  • Store deleted messages on the server and never permanently erase deleted messaged [Reason: Use the trash just like in gmail. But remember that gmail automatically deletes your trash after 30 days. So don't use your trash folder as your hidden archive!]
  • Consider using the IMAP Path prefix of [Gmail] as all the folders/labels are mapped under the folder [Gmail] in IMAP.
  • Tell your mail client which folders are used for Sent messages, Trash, Spam, Drafts. In Apple Mail right click in the corresponding Gmail folders and say: 'Use this mailbox for ...' [Reason: IMAP knows about folders, but doesn't standardize these special folders (apart from the Inbox). So one client might use 'Deleted messages, while another client might use 'Trash' to store deleted messages. This tells the mail client that it should use the same folder gmail uses.]

And now: Go and test it! Test it multiple times, in and out of every direction you can think of. Only use the setup if you are confident you didn't mess it up!

If your local mail client shows weird behavior after all these configs, invoke a Rebuild or Reconcile or however it is called from your client to re-sync mails with Gmail.

Freaking Ruby implicit return values interferes with Rails ActiveRecord callbacks

Thu Oct 25 2012 02:00:00 GMT+0200 (Central European Summer Time)

I just need to rant that (again) I run into a problem with unexpected side-effects of the usually neat feature of implicit return values in Ruby. This (although not really obvious) feature always returns the value of the last executed statement in a method as a return value. But this isn't always as obvious as it sounds. This can cause strange side-effects.

As an example take the Rails callbacks for ActiveRecord. These callbacks like :before_create are typically used to handle data validation. Thus if they return 'false', the process to save the record is canceled.

But now instead of validation you want to ensure that certain other attributes are automatically set depending on other attributes; maybe even boolean attributes like in this block:

class Message < ActiveRecord::Base 
	belongs_to :probe 
	attr_accessible :probe_id, :value1, :value2, :probe_enabled

	before_create :set_probe_enabled 
	private def set_probe_enabled 
		self.probe_enabled = self.probe.enabled? true 
		# if only this would have been obvious... 
	end 
end

Here we simply want to set the boolean attribute enabled? depending on the value of the enabled attribute of the associated probe. Obviously the probe.enabled? can either return true or false. Unfortunately in case of false the whole statement ' self.probe_enabled = self.probe.enabled?' returns false. And if this is the last statement being executed, the whole method will return false. And a false in such a callback will cancel the creation of the object...

Take-away lesson: Pay attention to implicit return values especially in Rails ActiveRecord callback methods when dealing with boolean values.

Comments are closed.
Previous