Updated on June 11, 2017
Try to recover from a failed Raspberry PI SD card
So my raspberry pi would no longer start. After some investigation I could only conclude that the SD card became corrupted. It would initially start but it would hang somewhere halfway. I would see new log entries when I added/removed usb deviced but it would not continue to boot.
So I first created an Ubuntu Live usb stick as described here: https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows
As luck would have it my SD card reader was broken, so I had to borrow another one. Misery loves company!
Then I tried to repair the disk, but it kept on failing.
$ sudo fsck -v /dev/sdX2 fsck from util-linux 2.20.1 e2fsck 1.42.9 (4-Feb-2014) sd-ext: recovering journal Superblock needs_recovery flag is clear, but journal has data. Run journal anyway<y>? yes fsck.ext4: unable to set superblock flags on sd-ext sd-ext: ********** WARNING: Filesystem still has errors **********
The next step was to create a (file) image of the SD Card:
sudo dd if=/dev/sdX of=/media/flogiston/SomeDrive/data/raspberry-complete.img
-
- sdX=> the value from X can be derived by doing a df -h before and after plugging in the corrupted sd card
That will give you a list of devices. Your new device may look like this:/dev/sdh1 56M 20M 37M 36% /media/flogiston/boot /dev/sdh2 15G 3,9G 10G 28% /media/flogiston/c1398422-7a7c-4863-8a8f-45a1db26b4f2
- sdX=> the value from X can be derived by doing a df -h before and after plugging in the corrupted sd card
=>
-
- As you can see the value of X is h in my case. Do NOT use /dev/sdh2, just use /dev/sdh in the example above. This will ensure that you will copy all partitions into the image
- /media/flogiston/SomeDrive/data => replace with path were you want your image to be saved
This may take a while. The larger your SD card, the longer this will take. Think half an hour or more. Time to get a coffee or some rest.
After your image has been created you can now fix it.
- Determine the starting block of each partition
parted /media/flogiston/SomeDrive/data/raspberry-complete.img unit B print
This will look a bit like:
Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 4194304B 62914559B 58720256B primary fat16 lba 2 62914560B 15811477503B 15748562944B primary ext4
Set up a loop device for each of the partitions:
use the Start bytes from the parted cmd to set up the loop devices:
➜ ~ sudo losetup -o 4194304 /dev/loop2 /media/flogiston/SomeDrive/data/raspberry-complete.img ➜ ~ sudo losetup -o 62914560 /dev/loop3 /media/flogiston/SomeDrive/data/raspberry-complete.img
Now we can repair the image
sudo fsck -y /dev/loop2 sudo fsck -y /dev/loop3
This could look a bit like:
➜ ~ sudo fsck -y /dev/loop2 fsck from util-linux 2.27.1 fsck.fat 3.0.28 (2015-05-16) /dev/loop2: 64 files, 2519/7161 clusters ➜ ~ sudo fsck -y /dev/loop3 fsck from util-linux 2.27.1 e2fsck 1.42.13 (17-May-2015) /dev/loop3: recovering journal Clearing orphaned inode 525978 (uid=107, gid=65534, mode=0100755, size=5) Setting free inodes count to 830406 (was 830407) Setting free blocks count to 2769926 (was 2769152) /dev/loop3: clean, 134362/964768 files, 1074938/3844864 blocks
Detach the image associated with the specified loop devices
➜ ~ sudo losetup -d /dev/loop2 ➜ ~ sudo losetup -d /dev/loop3
Now the image should be repared. We no longer trust the old SD card and use a brand new one to copy the repared image to:
sudo dd if=/media/flogiston/SomeDrive/data/raspberry-complete.img of=/dev/sdh
If you are out of luck, then the new SD card is a few bytes smaller then the other one. You will have to truncate the image (shave off some bytes at the end) to make it fit.
dd: writing to '/dev/sdh': No space left on device 30449665+0 records in 30449664+0 records out 15590227968 bytes (16 GB, 15 GiB) copied, 3830,5 s, 4,1 MB/s
I guess I was out of luck …
sudo apt install dcfldd sudo apt install gparted
➜ ~ sudo losetup -o 62914560 /dev/loop3 /media/flogiston/SomeDrive/data/raspberry-complete.img
➜ ~ sudo gparted /dev/loop3
gparted starts. Select the the /dev/loop3 partition and select Partition menu, Resize/Move . Change the value of “New Size” so that it is slightly below the maximum size. Eg. 100MB free space. Resize, apply all operations and wait. Wait. Wait!
DO NOT close the window after it is finished. When complete, it will display the new size. Make sure you write down the new size before you close the window. If you don’t see, it, click on details and drill down to the new size (a line like “resize2fs -p /dev/loop3 14980096K”) where the number in K is the new size in kilobytes.
Now remove the loopback device for the second partition, create a new loopback device for the whole image and edit the partition table to reflect the new smaller size:
sudo losetup -d /dev/loop3 sudo losetup /dev/loop3 /media/flogiston/SomeDrive/data/raspberry-complete.img sudo fdisk /dev/loop3
d 2 n p 2 122880 +14980096K w
➜ ~ sudo fdisk -l /dev/loop3 Disk /dev/loop3: 14,7 GiB, 15811477504 bytes, 30881792 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x000c45c9 Device Boot Start End Sectors Size Id Type /dev/loop3p1 8192 122879 114688 56M c W95 FAT32 (LBA) /dev/loop3p2 122880 30083071 29960192 14,3G 83 Linux ➜ ~ sudo losetup -d /dev/loop3 ➜ ~ truncate -s $(((30083071+1)*512)) /media/flogiston/SomeDrive/data/raspberry-complete.img sudo dcfldd if=/media/flogiston/SomeDrive/data/raspberry-complete.img of=/dev/sdh
Eject your new SD card, plug in to your Pi and reboot… Fingers crossed!
Source: http://www.aoakley.com/articles/2015-10-09-resizing-sd-images.php
Source: https://www.raspberrypi.org/forums/viewtopic.php?t=19468
Posted on November 25, 2012
Online tool: CSV to JSON
A nifty client-side (javascript) tool to convert a csv dataset to json
http://www.cparker15.com/code/utilities/csv-to-json/
And the source code: https://github.com/cparker15/csv-to-json
I placed a copy on my own site, for future reference
http://www.flogiston.net/datagenerator/csv-to-json.html
Posted on November 25, 2012
OpenVPN error: Warning: route gateway is not reachable on any active network adapters
Windows XP: disabling NetBIOS
- Open your Control Panel
- Open the Network Connections window
- Right-click the TAP-Win32 adapter and select Properties
- Select Internet Protocol (TCP/IP) and click Properties
- Click Advanced and select the WINS tab
- Select Disable NetBIOS over TCP/IP
- Click OK and close all the settings windows
- Try to connect to the VPN. If the problem is not resolved, continue to the next step.
Windows XP: adding netsh
- Click the OpenVPN icon in the taskbar
- Select the server you would normally try to connect to, but instead of connecting, choose Edit Config
- A notepad window will open with a few lines of technical text. Please don’t change any of the lines
- At the end of the file, one new line, please add the following 3 lines:
- route-delay 5
- route-method exe
- ip-win32 netsh
- Save and close the file.
- Try to connect and see if this helped.
Windows Vista / 7: adding netsh
- Click the OpenVPN icon in the taskbar
- Select the server you would normally try to connect to, but instead of connecting, choose Edit Config
- A notepad window will open with a few lines of technical text. Please don’t change any of the lines
- If you installed our most up-to-date installer for Windows Vista/Windows XP, the last 2 lines of the file should be:
- route-delay 5
- route-method exe
- If not, then please follow the Windows XP instructions.
- At the end of the file, one new line, please add the following 3 lines:
- ip-win32 netsh
- Save and close the file.
- Try to connect and see if this helped.
Windows XP: resettings Internet catalog
- Find the Command Prompt option in your Start Menu
- Right-click the Command Prompt option and select Run as administrator
- Once started a black window will appear, waiting for you to type commands
- Enter the following two commands, each followed by the ENTER key:
- netsh winsock reset catalog
- netsh int ip reset logfile.txt
- Make sure these commands did not you give you an error.
- Close the Command Prompt window and try to connect.
Windows Vista / 7: resettings Internet catalog
- Find the Command Prompt option in your Start Menu
- Right-click the Command Prompt option and select Run as administrator
- Once started a black window will appear, waiting for you to type commands
- Enter the following two commands, each followed by the ENTER key:
- netsh winsock reset
- netsh int ip reset
- Make sure these commands did not you give you an error.
- Close the Command Prompt window and try to connect.
source:
http://my.anuson.com/knowledgebase/61/OpenVPN-error-Warning-route-gateway-is-not-reachable-on-any-active-network-adapters.html
Updated on November 25, 2012
de / het woorden (Dutch)
de / het woorden zijn woorden die zowel onzijdig (het) als geslachtelijk zijn.
Andere betekenis
Soms heeft een het woord een andere betekenis dan hetzelfde de woord. Zo’n voorbeeld is idee.
Het idee betekent: ‘denkbeeld’, ‘gedachte’, ‘denkwijze’, ‘ingeving’, ‘mening’. Bijvoorbeeld:
– iemand op het idee brengen dat…
– dat idee moet je aan het bestuur voorleggen
– een goed idee hebben
– naar ons idee kan ze dat best
De idee betekent: ‘(filosofisch) denkbeeld’, ‘gedachte’. Bijvoorbeeld:
– de godsidee
– de platonische idee
– de marxistische idee
– de idee van het recht
– uit heel zijn werk komt duidelijk de volgende idee naar voren…
Woorden op -dom
Woorden op -dom zijn meestal het -woorden. Het zijn dan namen van plaatsen of gebieden (bijv. het bisdom, het heiligdom, het hertogdom ) ofwel verzamelnamen (bijv. het jodendom, het priesterdom, het regentendom, het veelgodendom ). Abstracta op -dom zijn de -woorden (bijv. de rijkdom, de ouderdom ).
Woorden op -schap
Bij de veel talrijker woorden op -schap zijn tweemaal twee categorieën te onderscheiden. Bij de de -woorden zijn deze twee categorieën:
- substantieven die een toestand aanduiden, bijv.: de blijdschap, dronkenschap, gevangenschap, kameraadschap, lijfeigenschap, verwantschap, vriendschap, zwangerschap
- verzamelnamen, bijv.: de gemeenschap, nakomelingschap, nalatenschap, vennootschap
- maar: het genootschap, gereedschap, gezelschap en het driemanschap (en de mogelijke, maar minder gebruikelijke woorden tweemanschap, viermanschap, enz.).
Woorden met de-genus die niet tot een van deze categorieën gerekend kunnen worden, zijn bijv.: de boodschap, eigenschap, rekenschap, weddenschap, wetenschap
Bij de het-woorden zijn eveneens twee categorieën te onderscheiden:
|
Woorden met het-genus die niet tot een van deze categorieën gerekend kunnen worden, zijn bijv.: het graafschap, heerschap, landschap
Soms kan een woord op -schap tot twee van de hierboven onderscheiden categorieën behoren en in overeenstemming daarmee met verschillend genus gebruikt worden, bijv. de priesterschap‘de gezamenlijke priesters’ en het priesterschap‘de priesterlijke waardigheid’. Het woord de/het zeggenschap komt zonder betekenisverschil met beide genera voor.
Andere substantieven | [ 3·3·2·4·i·3 ] |
Andere substantieven die met betekenisverschil als de– en als het-woord kunnen optreden, zijn bijv.:aas: de/het aas (in kaartspel) – het aas (‘voedsel’); afval: de afval (‘het afvallen’) – het/de afval (‘het afgevallene’; ‘vuilnis’); baai: de baai (‘zeearm’; ‘tabak’) – de of het baai (weefsel); bal: de bal (voorwerp) – het bal (‘ feest’); blik: de blik (‘oogopslag’) – het blik (metaal; voorwerp); bloed: de (onnozele) bloed – het bloed (‘lichaamsvocht’); bocht: de bocht (‘kromming’) – het/de bocht (‘slechte waar’); boeket: het/de boeket (‘bloemruiker’) – het boeket (‘geur en smaak’); boord: de boord (‘rand, kant’) – de of het boord (‘kraag’; van schip); bos: de bos (‘bundel’) – het bos (‘ woud’); bot: de bot (vis) – het bot (‘ been’); buis: de buis (‘pijp’) – het buis (kledingstuk); doek: de doek (‘lap’) – het doek (‘ schilderij’; ‘gordijn’) (n.b Als stofnaam het/de doek: zie ***EMPTY ra r5***.); duin: de of het duin (‘zandheuvel’) – het duin (verzamelnaam); eigendom: de eigendom (recht) – het eigendom (‘wat iemand toebehoort’); fortuin: de fortuin (‘(nood)lot’) – het fortuin (‘geld’; ‘geluk’); gemaal: de gemaal (‘echtgenoot’) – het gemaal (andere betekenissen); genie: de genie (legeronderdeel) – het genie (andere betekenissen); gift: de gift (‘geschenk’) – het gif(t) (‘vergif’); grauw: de grauw (‘snauw’) – het grauw (‘gepeupel’); heer: de heer (persoonsnaam) – het heer (‘leger’; ‘heerschap’); hof: de hof (‘tuin’) – het hof (andere betekenissen); idee: de idee (filosofische term) – het idee (‘denkbeeld’); jacht: de jacht (‘het jagen’) – het jacht (boot); kamp: de kamp (‘strijd’) – het kamp (‘ tijdelijke woonplaats’); kapitaal: de kapitaal (‘hoofdletter’) – het kapitaal (‘geld’); klad: de klad (‘smet’) – het klad (‘ voorlopige versie’); koppel: de koppel (‘band’) – het koppel (‘stel’); koraal: de koraal (‘kraal’) – het koraal (stofnaam; gezang); kwart: de kwart (muziekterm) – het kwart (‘vierde’); lek: de lek (‘het lekken’) – het lek (‘scheur, reet waaruit iets lekt’); licentiaat: de licentiaat (persoon) – het licentiaat (graad); lof: de lof (‘eerbetuiging’) – het lof (andere betekenissen); maal: de maal (‘keer’) (echter ook: dit maal) – het maal (‘maaltijd’); mens: de mens (algemeen) – het mens (‘ vrouw’) ; metaal: de metaal (bedrijfssector) – het metaal (stofnaam); moer: de moer (‘vlak lichaam waarin een gat met schroefdraad aan de binnenzijde’; ‘vrouwelijk wezen’) – het moer (‘veenmoeras’); omslag: de omslag (‘drukte’; ‘verandering’; ‘verdeling’) – de/het omslag (andere betekenissen); opzet: de opzet (andere betekenissen dan ‘voornemen’; ‘bedoeling’) – het opzet (‘voornemen’; ‘bedoeling’); pad: de pad (dier) – het pad (‘ weg’); patroon: de patroon (persoonsnaam; ‘huls met lading’) – het patroon (‘model’; ‘tekening’); pleister: de pleister (op een wond) – het pleister (stofnaam); port: de port (wijn) – de/het port(o) (‘vrachtloon’); portier: de portier (persoonsnaam) – het portier (‘deur’); punt: de punt (‘spits’); de/het punt (‘leesteken’) – het punt (andere betekenissen); ree: de ree (‘rede’) – de/het ree (dier); rek: de rek (‘het rekken’) – het rek (andere betekenissen); rijm: de rijm (‘rijp’) – het rijm (‘ klankgelijkheid’; ‘gedicht’); rot: de rot (‘rat’) – het rot (andere betekenissen); schap: het/de schap (‘plank’) – het schap (‘bedrijfschap’); schrift: de Schrift (‘Bijbel’) – het schrift (andere betekenissen); slag: de slag (andere betekenissen dan ‘soort’) – het slag (‘soort’); sloop: de sloop (‘het slopen’) – de/het sloop (‘kussenovertrek’); soort: de soort (in de biologie) – het of de soort (andere betekenissen); spoor: de spoor (‘spore’; ‘uitsteeksel’) – het spoor (andere betekenissen); stempel: de stempel (deel van een plant; steunbalk) – de of het stempel (‘stempelwerktuig’; ook figuurlijk) – het stempel (‘stempelafdruk’; ook figuurlijk); stift: de stift (‘staafje’) – het stift (‘klooster’); stof: de stof (andere betekenissen dan ‘stuifsel’) – het stof (‘stuifsel’); substituut: de substituut (persoonsnaam) – het substituut (zaaknaam); textiel: de textiel (bedrijfssector) – de of het textiel (stofnaam); thema: de/het thema (schoolopgave) – het thema (‘onderwerp’); toeval: de/het toeval (‘aanval van (vallende) ziekte’) – het toeval (‘onberekenbaar gebeuren’); veer: de veer (van vogel; ‘springveer’) – het veer (‘pont’); vizier: de vizier (persoonsnaam) – het vizier (andere betekenissen); vlak: de vlak (‘smet’) – het vlak (andere betekenissen); vlek: de vlek (‘smet’) – het vlek (‘ dorp’); vocht: de of het vocht (‘vochtigheid’) – het vocht (‘vloeistof’); want: de want (‘handschoen’) – het want (‘touwwerk’); was: de was (andere betekenissen dan de stofnaam) – de/het was (stofnaam); wee: de wee (‘barenswee’) – het wee (andere betekenissen); weer: de weer (in de uitdrukking in – zijn; ook in samenstellingen als brandweer en noodweer) – het weer (‘atmosferische toestand’); weerlicht: de weerlicht (krachtterm) – het/de weerlicht (natuurverschijnsel); welp: de welp (‘jonge padvinder’) – de/het welp (jong van bepaalde dieren); wissel: de wissel (andere betekenissen dan ‘spoorwegwissel’) – de/het wissel (‘spoorwegwissel’); wurm: de wurm (‘worm’) – het wurm (‘ kind’); zegel: de zegel (‘plakzegel’) – het zegel (andere betekenissen); zicht: de zicht (‘kleine zeis’) – het zicht (andere betekenissen) |
Regionale verschillen
Soms zijn er regionale verschillen:
In België wordt thuis opgevat als de-woord, in Nederland als het-woord.
Evolutie van een woord
Of evolueert een woord met de loop der tijd:
Engelse leenwoorden krijgen gewoonlijk het lidwoord de. Van sommige Engelse leenwoorden komt na verloop van tijd echter ook een het-vorm in omloop. Met cluster lijkt dit ook het geval te zijn: de meeste naslagwerken geven de cluster (mannelijk), maar sommige ook het cluster (onzijdig).
Procent is volgens de woordenboeken een het-woord. In de praktijk wordt procent echter steeds meer ook als de-woord gebruikt. In België is dat vaker het geval dan in Nederland.
Contextuele verschillen
Heel af en toe zijn er context verschillen:
Zowel de nuclide als het nuclide is goed. In gewoon taalgebruik wordt meestal de nuclide gebruikt. In wetenschappelijke teksten komt vaak het nuclide voor.
Het zelfstandig naamwoord spits (onder andere ‘puntig uiteinde’) wordt doorgaans voorafgegaan door het lidwoord de. Alleen in de vaste uitdrukkingen de/het spits afbijten (‘de eerste in de aanval zijn’, ‘iets als eerste doen’) en de/het spits bieden aan (‘zich krachtig verzetten tegen’) kan het woord ook onzijdig zijn. In de Woordenlijst wordt spits echter alleen als de-woord vermeld.
Zo is in het algemene taalgebruik microscoop een de-woord; het microscoop is beperkt tot technisch taalgebruik. Iets dergelijks geldt voor het algoritme tegenover de algoritme (vaktaal) en voor de haas, de patrijs en de ree naast het haas, het patrijs en het ree , gebruikelijk in jagerstaal.
“Echte” de/het woorden: geen betekenisverschil
Hier volgen enkele van de bekendste voorbeelden van zelfstandige naamwoorden die zowel de-woord als het-woord kunnen zijn zonder dat er sprake is van een betekenisverschil: aanrecht, affiche, colofon, deksel, doolhof, fabriek (het fabriek is regionaal en ‘volkstaal’), getuigenis (zie vuilnis), gordijn, kaft, klimop, modem, molecule, periodiek, scala, soort, tenue, uniform (in Nederland zijn tegenwoordig het tenue en het uniform ook onder militairen het meest gebruikelijk, bijvoorbeeld het gevechtstenue, het dagelijkse tenue; daarnaast wordt nog wel gesproken van de geklede en de ceremoniële tenue), vuilnis (bijna alle woorden op -nis zijn vrouwelijk; de vuilnis is dan ook ouder, maar voor de verzamelnaam vuilnis is het lidwoord het gewoon geworden).
Hieronder volgen drie reeksen van woorden die in de standaardtaal zonder betekenisverschil als de- en als het-woord gebruikt kunnen worden. Woorden die in een bepaalde betekenis dubbel genus kunnen hebben en in een andere betekenis niet (bijv. het/de bocht ‘slechte waar’ tegenover de bocht’kromming’) zijn vermeld in en worden hier niet herhaald.
Het de-genus komt het meest voor bij:
de/het accordeon, animo, automatiek, bagatel, boezeroen, brio, carrousel, circumflex, corsage, diadeem, figuur, filet, filter, floret, foetus, handel/hendel, heethoofd, hippodroom, hocus-pocus, hondsvot, introïtus, jolijt, kaft, karwei, katern, keer (deze keer, maar ook: dit keer; vergelijk maal ), kilo, klimop, koliek, kraam, lidmaat, liniaal, lis (‘plant’), lorgnet, manoeuvre, matras, mechaniek, molecule, mortier, order, orgelpunt, oriënt, pancreas, parterre, pipet, pleuris/pleuritis, potpourri, prae, proviand, ratjetoe, reliek, remedie, retabel, roodvonk, salon, scheurbuik, schort, schurft, sex-appeal, solo, soort, status, subsidie, takel, teint, transfer, uitwas, uitzet, vendu, voldoende, voorschoot, welp, zadel, zeggenschap, zuivel
. Het het-genus komt het meest voor bij:
het/de aanrecht, affiche, aperitief, baldakijn, bidet, bruikleen, carillon, carré, chalet, circus, colbert, colofon, commentaar, concours, creatuur, debacle, depot, deksel, dressoir, embonpoint, ex-voto, factotum, festoen, feuilleton, fiche, fond, galon, gamma (‘geordende reeks’), getuigenis, gilde, gobelin, gordijn, hiaat, idee-fixe, imperiaal, impromptu, jacquet, karkas, klavecimbel, koord, leeghoofd, lef, loeder, lor, membraan, mengelmoes, menu, menuet, micron, mom, montuur, mud, octaaf, omnium, overtrek, pandoer, pedaal, pendant, periodiek, pincet, plastron, plus, raster, riool, risico, rooster, scapulier, scharminkel, schepel, schilderij, schrijn, silhouet, slem, stencil, stort (‘stortplaats’), struma, tabernakel, taboe, tenue, tribuut, uniform, vereiste, vergiet, viaduct, vod, voltage, vuilnis, warhoofd, zadel, zijspan
. Het genus is onduidelijk bij:
de of het appendix, brok, complet, facie, fries (in de bouwkunst), kameleon, kruim, piëdestal, poeha, prospectus, tablet
Bronnen:
http://taaladvies.net/taal/advies/vraag/1168
http://taaladvies.net/taal/advies/vraag/525
http://taaladvies.net/taal/advies/vraag/556
http://taaladvies.net/taal/advies/vraag/169
http://ans.ruhosting.nl/e-ans/03/03/02/04/body.html
Updated on January 8, 2012
Utility to upgrade a Joomla 1.5 template to 1.7
I’ve made a utility to upgrade a Joomla 1.5 template to make it compatible with 1.7.
Try it out here.
I’ve only tried it out on one template, so be very carfull when you try it: backup your original data or try it out on a local environment before installing it on a production environment.
If you used and liked this utility, consider donating some money so I can enjoy a nice cigar or a fine whisky. I’d appreciate it!
Posted on July 18, 2011
Regex: match 4 or more consecutive letters or numbers
([a-z-0-9])\1{3,}
Sites to test:
http://www.regexplanet.com/simple/
http://www.rubular.com/
http://www.cyber-reality.com/regexy.html
http://www.spaweditor.com/scripts/regex/index.php
Posted on July 16, 2011
Extract winmail.dat files in linux
Source: http://www.faqforge.com/linux/how-to-open-winmail-dat-files-on-ubuntu-or-debian-linux/
The winmail.dat file is a container file format used by Microsoft Outlook to send attachments in richtext formatted emails. To open winmail.dat on Linux, use the tnef utility.
Installation
sudo apt-get install tnef
Usage
Open a shell window, navigate to the directory where the winmail.dat file is saved, then execute the command:
tnef winmail.dat
to extract all files that are stored in the winmail.dat into the current directory.
Posted on July 16, 2011
Repair corrupted zipfiles in linux
Source: http://techie-buzz.com/foss/fix-corrupted-zip-files-in-linux-quick-tip.html
You can easily repair “repairable” zip files downloaded on Linux by issuing the following command;
zip –F 'filename.zip'
Issuing this command will tell the zip command to try to fix the zipfile if necessary. You can also issue the following command to make it the zip command work more harder on fixing the zip file.
zip –FF 'filename.zip'
Updated on July 16, 2011
Funny source code comments
http://cobaia.net/2010/09/top-funny-source-code-comments/
and the original
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
And, on a slightly related note … xkcd … http://xkcd.com/210/
Updated on July 13, 2011
Argument list too long
Source:http://www.linuxjournal.com/article/6060?page=0,0
Four approaches to getting around argument length limitations on the command line.
At some point during your career as a Linux user, you may have come across the following error:
[user@localhost directory]$ mv * ../directory2
bash: /bin/mv: Argument list too long
The “Argument list too long” error, which occurs anytime a user feeds too many arguments to a single command, leaves the user to fend for oneself, since all regular system commands (ls *, cp *, rm *, etc…) are subject to the same limitation. This article will focus on identifying four different workaround solutions to this problem, each method using varying degrees of complexity to solve different potential problems. The solutions are presented below in order of simplicity, following the logical principle of Occam’s Razor: If you have two equally likely solutions to a problem, pick the simplest.
Method #1: Manually split the command line arguments into smaller bunches.
Example 1 [user@localhost directory]$ mv [a-l]* ../directory2 [user@localhost directory]$ mv [m-z]* ../directory2
This method is the most basic of the four: it simply involves resubmitting the original command with fewer arguments, in the hope that this will solve the problem. Although this method may work as a quick fix, it is far from being the ideal solution. It works best if you have a list of files whose names are evenly distributed across the alphabet. This allows you to establish consistent divisions, making the chore slightly easier to complete. However, this method is a poor choice for handling very large quantities of files, since it involves resubmitting many commands and a good deal of guesswork.
Method #2: Use the find command.
Example 2 [user@localhost directory]$ find $directory -type f -name '*' -exec mv {} $directory2/. \;
Method #2 involves filtering the list of files through the find command, instructing it to properly handle each file based on a specified set of command-line parameters. Due to the built-in flexibility of the find command, this workaround is easy to use, successful and quite popular. It allows you to selectively work with subsets of files based on their name patterns, date stamps, permissions and even inode numbers. In addition, and perhaps most importantly, you can complete the entire task with a single command.
The main drawback to this method is the length of time required to complete the process. Unlike Method #1, where groups of files get processed as a unit, this procedure actually inspects the individual properties of each file before performing the designated operation. The overhead involved can be quite significant, and moving lots of files individually may take a long time.
Method #3: Create a function. *
Example 3a function large_mv () { while read line1; do mv directory/$line1 ../directory2 done } ls -1 directory/ | large_mv
Although writing a shell function does involve a certain level of complexity, I find that this method allows for a greater degree of flexibility and control than either Method #1 or #2. The short function given in Example 3a simply mimics the functionality of the find command given in Example 2: it deals with each file individually, processing them one by one. However, by writing a function you also gain the ability to perform an unlimited number of actions per file still using a single command:
Example 3b function larger_mv () { while read line1; do md5sum directory/$line1 >> ~/md5sums ls -l directory/$line1 >> ~/backup_list mv directory/$line1 ../directory2 done } ls -1 directory/ | larger_mv
Example 3b demonstrates how you easily can get an md5sum and a backup listing of each file before moving it.
Unfortunately, since this method also requires that each file be dealt with individually, it will involve a delay similar to that of Method #2. From experience I have found that Method #2 is a little faster than the function given in Example 3a, so Method #3 should be used only in cases where the extra functionality is required.
Method #4: Recompile the Linux kernel. **
This last method requires a word of caution, as it is by far the most aggressive solution to the problem. It is presented here for the sake of thoroughness, since it is a valid method of getting around the problem. However, please be advised that due to the advanced nature of the solution, only experienced Linux users should attempt this hack. In addition, make sure to thoroughly test the final result in your environment before implementing it permanently.
One of the advantages of using an open-source kernel is that you are able to examine exactly what it is configured to do and modify its parameters to suit the individual needs of your system. Method #4 involves manually increasing the number of pages that are allocated within the kernel for command-line arguments. If you look at the include/linux/binfmts.h file, you will find the following near the top:
/* * MAX_ARG_PAGES defines the number of pages allocated for arguments * and envelope for the new program. 32 should suffice, this gives * a maximum env+arg of 128kB w/4KB pages! */ #define MAX_ARG_PAGES 32
In order to increase the amount of memory dedicated to the command-line arguments, you simply need to provide the MAX_ARG_PAGES value with a higher number. Once this edit is saved, simply recompile, install and reboot into the new kernel as you would do normally.
On my own test system I managed to solve all my problems by raising this value to 64. After extensive testing, I have not experienced a single problem since the switch. This is entirely expected since even with MAX_ARG_PAGES set to 64, the longest possible command line I could produce would only occupy 256KB of system memory–not very much by today’s system hardware standards.
The advantages of Method #4 are clear. You are now able to simply run the command as you would normally, and it completes successfully. The disadvantages are equally clear. If you raise the amount of memory available to the command line beyond the amount of available system memory, you can create a D.O.S. attack on your own system and cause it to crash. On multiuser systems in particular, even a small increase can have a significant impact because every user is then allocated the additional memory. Therefore always test extensively in your own environment, as this is the safest way to determine if Method #4 is a viable option for you.