2017-10-27
Reset screen terminal after printing garbage
To reset it:
- press Ctrl-A
- enter ":reset" and press enter
Done. You many need to enter "reset" in the terminal itself as well.
2016-07-09
rsyslogd does not log kernel messages to kern.log on Ubuntu 14.04.1 and OpenVZ
This one was tough. Googling showed that this problem could be solved by uncommenting the line '$ModLoad imklog' in /etc/rsyslog.conf. This in turn caused kern.log to be filled with messages like 'imklog: error reading kernel log - shutting down: Bad file descriptor'. This in turn is probably caused by some strange interaction between Ubuntu and OpenVZ/virtualization combination, but initially I did not find the precise cause of the problem, nor a solution.
This link finally gives a clue what the problem is and also presents a working workaround:
http://www.nostate.com/4228/fixing-the-100-cpu-and-no-useful-output-imklogrsyslog-kernel-logging-problem-on-ubuntu-guests-under-xen-pv/
Following the solution worked for me. In more detail:
Create file /etc/init/kmsg-pipe.conf with the following content:
Then execute the script and restart rsyslogd:
2015-11-08
Reset Toner on Brother MFC-9340CDW
See also https://www.timoschindler.de/brother-mfc-9140cdn-toner-resetten/
2015-09-30
Copy multiple lines from Windows Command Prompt (cmd.exe)
2015-09-28
Visual Studio Intellisense: No focus on suggestions.
2015-09-17
Volumio autoplay with NAS (hack)
Goal: Let Volumio 1.55 automatically start playing music automatically after the Raspberry Pi is powered on. The RPi is used completely headless and without any buttons, and while it is fine that I can control it through my phone or a computer, I sometimes just want to start the music on random play by flicking a plain old power switch and nothing more.
After a lot of fiddling with /etc/rc.local I realized that the NAS is mounted only after my commands in rc.local were executed. A sleep may help, but rc.local is killed if you sleep to long ... argh, nasty!
Instead I decided to hardcode the autoplay into the PHP scripts directly. I don't know any PHP, but how hard can it be?
Edit file /var/www/command/player_wrk.php and search for 'WORKER MAIN LOOP'.
Add the following lines before the '// --- WORKER MAIN LOOP --- //' line:
// Autoplay
sleep(5);
$cmd = 'amixer cset numid=3 1';
sysCmd($cmd);
$cmd = 'mpc repeat on';
sysCmd($cmd);
$cmd = 'mpc random on';
sysCmd($cmd);
$cmd = 'mpc consume off';
sysCmd($cmd);
$cmd = 'mpc single off';
sysCmd($cmd);
$cmd = 'mpc play';
sysCmd($cmd);
The amixer line tries to force 3.5mm jack audio output. Not sure this works. Omit it if you use your own DAC or HDMI.
Not sure the sleep(5) is necessary. This is actually not specific for NAS and should work with any source. It should play the playlist which was last active.
I would love to have this in the GUI, but I do not know how to hack that in.
Ah yes. Completely unrelated and just so I do not forget it: To get my TL-WN725N WLAN Dongle working with volumio 1.55 I had to download the firmware for it:
sudo wget https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin -O /lib/firmware/rtlwifi/rtl8188eufw.bin
2015-05-07
Mac OS X telnet escape character on a german keyboard is Ctrl+Ü
2015-01-12
Update Samsung SSD 840 EVO firmware on Zotac Linux server (poor read performance of old files).
I have a Zotac server without a CD drive, so I needed to run the Samsung Performance Restauration tool. I used the DOS / Mac variant which is a DOS bootable disk which contains the update tool. The easiest way to prepare the USB stick is NOT to use the USB zip provided by Samsung but to use the *.iso file (Samsung_Performance_Restoration.iso) instead:
- Mount the ISO file and get the file ISOLINUX/BTDSK.IMG from it.
- dd the BTDSK.IMG directly onto a USB stick
- boot from the USB stick and follow the instructions
On my Zotac machine when booting from this USB stick I got a couple of broken error messages about not being able to boot from device XYZ, but it booted OK from the stick after a couple of seconds.
The performance restauration procedure took 4.5h for a 1TB SSD (60% full) and about 15h for another 1TB SSD (95% full), so expect this to take some time.
Both SSDs were not erased by the procedure.
Avoid hang of headless Zotac server on Ubuntu Linux reboot. (How to disable the graphical console for grub and the Linux kernel.)
Edit /etc/default/grub
Uncomment this line:
GRUB_TERMINAL=console
In addition I disabled setting any graphics mode on the Linux kernel and setting the timeout to 1 second.
My /etc/default/grub file now looks like this:
2014-10-03
Copy files using rsync as root when the remote host does not allow root access and ssh is on a different port
- Step 1: Make sure you can execute commands as root on the remote host after logging in, without entering your password. For this there are two alternative options:
- You can allow the user to execute sudo without entring the users password. You can do this by adding the following line to the end of /etc/sudoers:
ALL=NOPASSWD: ALL - You can enter the sudo password in advance once and make sure it is cached between sessions. To make sure it is cached between sessions you must add the '!tty_tickets' option to the Defaults line in /etc/sudoers, and then you must run a dummy command as root:
- Defaults env_reset,!tty_tickets
- ssh -p PORT
-t USER @REMOTE_HOST sudo id - Step 2: Do the rsync. Override the ssh port. Specify "sudo rsync" as remote rsync command. Target the rsync at the non-root user which can now sudo:
- sudo rsync -avRe "ssh -p PORT
" --rsync-path "sudo rsync" LOCAL_DIR USER @REMOTE_HOST :
2014-09-29
Ubuntu Linux: Show network throughput of network device eth0 etc in bytes: iftop -B
iftop
To show the bandwidth in Bytes/s
iftop -B
2014-08-11
Quit screen on german keyboard
- Ctrl-A : quit
Save screen scrollback buffer to file
- Ctrl-A : hardcopy -h file.txt
2014-08-03
2014-04-30
Strip PDF restrictions on Mac OS X without any special tools
- open the Printer Queue for your Printer
- stop the Queue
- print the PDF
- now you should have a file starting with 'd' under /var/spool/cups which is an unprotected version of your PDF
- in Terminal type sudo cp /var/spool/cups/d* ~/Desktop/d.pdf
- this assumes there is just one file starting with a 'd' which is usually the case. If there are multiple files pick one by one until you have your file.
- in Terminal type sudo chown foo:foo ~/Desktop/d.pdf (replace foo with your actual user name)
- file ~/Desktop/d.pdf does not have any restrictions
- in the Printer Queue delete the print job
- start the Printer Queue
2014-02-26
Mac OS X Lion: Scan for wireless networks
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
Also, to see additional information about the currently active wireless connection hold down the Option key while clicking on the Airport Symbol in the menu bar.
2014-02-17
Common bashrc settings
alias e=jed
alias mv="mv -i"
alias cp="cp -i"
alias rm="rm -i"
complete -r
export LANG=C
export EDITOR=jed
export PATH=$PATH:${HOME}/bin
2014-02-07
Zotac Zbox ID18 Linux Server
- Zotac Zbox ID18
- Samsung SSD 840 EVO 1TB
- 4GB RAM (SODIMM 1600)
- Ubuntu 13.10
- download the 'Windows' Firmware update for the 840 EVO
- mount it
- dd the btdsk.img onto a USB stick
- put the USB stick into the Zotac
- change the Zotac BIOS so it boots from the USB stick
- reboot
- ignore all error messages about missing partitions
- eventually the Samsung Firmware Update program comes up
- take note of the Firmware revision
- follow the instructions of the program
- wait
- ignore the message about power cycling the SSD, since you cannot power cycle it in isolation
- ignore the message about the firmware update being unsuccessful
- reboot (still from the USB stick)
- check that you have the new firmware revision
- Linux shows: ata1.00: ATA-9: Samsung SSD 840 EVO 1TB, EXT0BB6Q, max UDMA/133)
- Enable TRIM support and avoid unnecessary writes when reading files and dirs:
- /etc/fstab:
- UUID=
/ ext4 discard,noatime,errors=remount-ro 0 1 - Reduce amount of disk space reserved for root from 45GB to 1GB:
- sudo tune2fs /dev/sda1 -m 0.1
- Install sshd:
- sudo apt-get install openssh-server
- Install 'sensors' to check the CPU temp:
- sudo apt-get install lm-sensors
- sudo sensors-detect
- sudo service kmod start
- sensors
- Install 'smartmontools' to see the SSD temp and other interesting data:
- sudo apt-get install smartmontools
- sudo smartctl -x /dev/sda | grep -i 'Current Temp'
- Do not start GUI/X
- edit /etc/default/grub:
- #GRUB_HIDDEN_TIMEOUT=0
- GRUB_TIMEOUT=1
- GRUB_CMDLINE_LINUX_DEFAULT="text"
- sudo jed /etc/default/grub
- sudo update-grub
- I like to install:
- sudo apt-get install jed apcalc screen minidlna openssh-server samba emacs ispell subversion g++ imagemagick
- If you have a couple of minutes:
- sudo apt-get update
- sudo apt-get upgrade
- If you would like to manually TRIM the SSD:
- sudo fstrim -v /
- Install SAMBA:
- sudo apt-get install samba
- see https://help.ubuntu.com/12.04/serverguide/samba-fileserver.html
2014-02-03
jed settings for indent=4, just spaces, line numbers on, sane brace insertion
USE_TABS = 0; LINENUMBERS = 2; % For the following to work you _must_ comment out any c_set_style() call! C_INDENT = 4; C_BRACE = 0; C_BRA_NEWLINE = 0; C_Colon_Offset = 0; C_CONTINUED_OFFSET = 4; public variable C_Class_Offset = 4;
2013-03-29
Brother MFC-7440N Toner empty message
This time the 'tape across toner window' trick would not work, even with black tape. The 'toner empty' message would only go away after doing this strange procedure which probably resets some internal state so it re-checks the toner state:
Open the front cover, then press the Back (german:Storno) button (the left bottom one of the four round black buttons), then press * 0 0 and then * 1 0. (Do not press 1 or 2 as indicated in the display. This is for the drum.) After this the 'toner empty' and also the 'toner almost empty' messages were gone and I could perfectly print again.
A subset of * 0 0 and * 1 0 might be sufficient. Not 100% sure the black tape is necessary at all.
Now the printer is printing happily and in perfect quality again. Lets see how long. :-)
2012-11-19
Mac OS X Desktop Background is gray
(I am using an external monitor connected to the Mac Book Pro and I put this configuration to sleep and I turn the monitor off at least once a day. I do not power down or reboot the laptop at all unless absolutely necessary.)
Logging out and back in solves the problem, but is of course tedious. I found a better workaround here: http://reviews.cnet.com/8301-13727_7-57389668-263/os-x-desktop-backgrounds-gray-after-waking-from-sleep/
- open a Terminal
- type: killall Dock
2012-06-14
Ubuntu 12.04: Boot Windows by default
http://askubuntu.com/questions/100232/how-do-i-change-the-grub-boot-order
I was using the GUI option since the manual option requires you to know the index of the Windows entry upfront (index starting at 0, for me Windows was at index 5).
This is what I did:
- Start a Terminal (search for 'Terminal' in one of the topmost icons), then paste/type this into the terminal: sudo add-apt-repository ppa:danielrichter2007/grub-customizer (enter password) sudo apt-get update sudo apt-get install grub-customizer grub-customizer (program comes up) - click Preferences - select Windows as default - Close - Save - close the program - restart to test it, done
2012-06-07
Viewing local manpages (files)
man ./foo.1
2012-05-24
CPU Benchmark Intel Core i3-2350M vs Intel Core i7-2820QM
The benchmarks are of course rather meaningless.
Machines:
- Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
- (dual core, 4 cores with hyperthreading, no turbo boost)
- (in a Lenovo B570 M58GMGE, 8GB, Ubuntu 12.04)
- (according to cat /proc/cpuinfo)
- Intel(R) Core(TM) i7-2820QM CPU @ 2.30GHz
- (quad core, 8 cores with hyperthreading, turbo boost up to 3.4GHz)
- (in a MacBookPro8,2, 8GB, Mac OS 10.7.4)
- (according to Temperaturmonitor 4.94)
Benchmark i3 i7 speedup g++-4.6 6.8s 3.9s 1.74x calc 5.7s 4.2s 1.36x Cinebench CPU 2.22P 4.63P 2.09x (i3 Win7, i7 OSX) Cinebench GL 12.40 27.90 2.25x (i3 Win7, i7 OSX) Cinebench CPU - 1.24 - (VirtualBox guest Windows 7, host OSX, 1 CPU) Cinebench CPU - 4.27 - (VirtualBox guest Windows 7, host OSX, 8 CPUs) (s in real time)
Benchmark command lines:
- time make CXX=g++-mp-4.6 OPT=-O3 -j 20
- compiling streplace 0.9.36
- just 5 parallel objects (does not fill the 8 slots of the i7)
- time calc 'log(fact(11**5))
- single core
- Cinebench 11.5 on Windows 7 SP1 and Max OS X 10.7.4
2011-11-28
Copyright-restriction-free Christmas songs from the Musikpiraten e.V.:
http://cdn.musikpiraten-ev.de/singen-im-advent-2011.pdf
2011-09-13
Create Booklet PDF service (Mac OS X)
http://www.macupdate.com/app/mac/21068/create-booklet-pdf-service
This worked for me from Word 2011 on Mac OS X Lion 10.7.1 and probably works for any other program as well as this is a universal PDF service (Create Booklet in the PDF menu button in every print dialog).
2011-09-03
Mac OS X Lion Apple Mail: Search does not work
This cured the problem for me:
Foe each individual mailbox (Inbox, Sent, all your own mailboxes) do:
Menu (not context menu): Mailbox -> Restore (in german: Postfach -> Wiederherstellen)
Juniper SSL VPN SAM does not work on Mac OS X Lion (10.7)
The reoccurring pattern continues: With every individual new Mac OS X version Apple kills existing VPN solutions for Max OS. This is at least true for Cisco VPN and also for the Juniper SSL PVN.
For the Juniper SSL VPN on Mac OS X Lion (10.7) the symptom for me was that the host checker never was loaded and never came up. The browser would just sit there indefinitely.
To get the Juniper SSL VPN working on Lion I found this solution:
https://discussions.apple.com/message/15760121#15760121
(replicated on this webpage:)
http://superuser.com/questions/322690/how-do-i-access-juniper-networks-secure-access-web-vpn-from-os-x-lion
1) Download and install Pacifist from: http://www.charlessoft.com/Pacifist.dmg
2) Download and Mount JavaForMacOSX10.6Update5 from http://support.apple.com/kb/DL1360
3) Download and Mount JavaForMacOSX10.7 from http://support.apple.com/kb/DL1421
4) Launch Pacifist and select Open Package
5) Select the mounted JavaForMacOSX10.6Update5.pkg
6) Hit install, when it prompts always select "Replace"
7) After it is complete, select Open Package and select the JavaForMacOSX10.7.pkg
8) When it prompts select "Replace"
9) You can copy Safari 5.0.5 from SL or if you do not have access to a SL machine
10) Download and mount Safari 5.0.5 from http://appldnld.apple.com.edgesuite.net/content.info.apple.com/Safari5/041-0564.20110413.Fi9pb/Safari5.0.5SnowLeopard.dmg
11) In Pacifist select Open Package and select the Safari 5.0.5 pkg file
12) This time select Extract and place it onto your desktop
13) Go to the Safari5.0.5SnowLeopard folder on your desktop, inside of that you will see an Applications folder, open that and you will see Safari, you can rename this Safari, I named mine Safari 5.0.5 and copy it to your main Applications folder or whereever you want.
14) Launch this Safari and go to About and make sure it says 5.0.5
15) Try your Secure App Manager.
Essentially you need to install the 10.6 Java and the 10.7 Java and downgrade to Safari 5.0.5 (at least 5.1 does not work).
The above description worked for me. I got a couple of error messages saying that files cannot replace folders, but this seems to be harmless. Just continue with 'Replace'.
2011-08-25
Converting Mac/LF encoding to Latin1/LF
recode mac/..l1 myfile.txt
Or convert UTF-8 to Latin1:
recode utf-8/..l1 myfile.txt
Will we ever be able to get rid of the OS dependent behavior like 'Mac text files have CR lineendings' (which is even wrong since Mac OS X)?
2011-08-22
Mac OS X Screen-Sharing: Cut-Copy-Paste
For example to transfer from your host to your remote machine:
* copy on host machine
* Screen-Sharing: Edit->Send copy buffer
* paste on remote machine