The problem: I have a Mac keyboard where the Alt/Win (i.e. Option/Command) keys are inverted compared to a regular PC keyboard, and I’d like to swap them. The answer: [codesyntax lang=”bash”] # clear all options setxkbmap -model “pc105” -layout “us,se” -option “” # set the Apple keyboard setxkbmap -rules “evdev” -model “pc105” -layout “us,se” -option … Continue reading Swap Alt and Windows keys with xmodmap?→
After upgrading the kernel to 4.8.13-1-ARCH some of the vmware kernel modules failed to compile: /tmp/modconfig-6BT70S/vmmon-only/linux/hostif.c:1592:47: error: ‘NR_ANON_PAGES’ undeclared (first use in this function) /tmp/modconfig-BBuLH6/vmnet-only/netif.c:468:7: error: ‘struct net_device’ has no member named ‘trans_start’; did you mean ‘mem_start’? The fix: [codesyntax lang=”bash”] cd /usr/lib/vmware/modules/source tar xf vmnet.tar tar xf vmmon.tar mv vmnet.tar vmnet.old.tar mv vmmon.tar vmmon.old.tar sed … Continue reading VMware modules, Arch Linux & kernel 4.8.13→
Ever happened to be focused on something and miss the fact that your laptop is running out of battery? And to lose your work? Yesterday happened twice! “Really? Hmm… I need to fix this as soon as possible.” I googled a bit and this stackexchange post popped up. Nice, great! But being notified even when you’re … Continue reading Be notified when critical battery level is reached→
If you would need to set up your displays once every week or less using the GUI is just fine. I had to do it every morning and after a while it became really annoying. Turn off the HDMI display: [codesyntax lang=”bash”] xrandr –output HDMI1 –off [/codesyntax] Turn on the HDMI display and set it … Continue reading How to set up multiple monitors in linux (using xrandr)→
It looks like Marvel is generating some data everyday. Is there a way to reduce the amount of data generated by marvel? The short answer to the above question is Yes! [codesyntax lang=”bash”] curator –host 127.0.0.1 show indices –older-than 30 –time-unit days –timestring ‘%Y.%m.%d’ –prefix .marvel curator –host 127.0.0.1 close indices –older-than 30 –time-unit days … Continue reading Marvel indices taking lot of space? Delete indices older than 7 days!→
At this point there are two approaches to achieve this. One is using pt-kill from Percona Toolkit, and the other one is to use a bash script with a lot of pipes :) Why would someone use the second approach? I don’t know, perhaps because there is no Percona Toolkit available. [codesyntax lang=”bash”] for i … Continue reading Kill all mysql queries having query time greater than 1 minute→
Recently one machine was swapping. No free space on the swap partition. Hmmm… Since this machine was used as a database server, obviously I suspected mysql. But why to guess when I could knew for sure which process was swapping… [codesyntax lang=”bash”] for file in /proc/*/status ; do awk ‘/VmSwap|Name/{printf $2 ” ” $3}END{ print “”}’ $file; … Continue reading Which processes are swapping?!→
It happened many times to need a quick access to the remote console of a server like HP’s ILO and not be able to open a web browser just to access it. So let access it via SSH. Here goes. [codesyntax lang=”bash”] ssh ilo_admin@ip_address [/codesyntax] 2. Enter your ILO admin account and password. After that you will see … Continue reading Access HP’s ILO remote console via SSH→
My storage is acting weird today and I’m trying to fix it with this command: [codesyntax lang=”bash”] fsck.ext4 -vcDfty -C 0 /dev/vg0/lv0 [/codesyntax] And the result was: /dev/vg0/lv0: ***** FILE SYSTEM WAS MODIFIED ***** 6329 inodes used (0.01%, out of 107380736) 44 non-contiguous files (0.7%) 4 non-contiguous directories (0.1%) # of inodes with ind/dind/tind blocks: … Continue reading Check and mark badblocks on ext4 partitions→
At some point I counted my DROP rules in my firewall and the result was kinda frightening. A lot of subnets and even more IPs… What was really annoying was that there were a lot of IP addresses which belonged to an already blocked subnet, so I needed a script to check this for me. … Continue reading Check if an IP is in a subnet→