Posts

Showing posts from August, 2017

Linux Kernel Swappiness

Image
I use an 8GB Ubuntu Desktop. When the memory usage approached 6 GB, the machine was dragged into a swap nightmare. The machine is mostly good, responsive, but the sata hard disk is sub par with the rest of the system. It's slow for read and write. It's slow for booting and extremely slow for swapping. Researching for Linux hard disk tuning , found a suggestion to change the kernel variable vw.swappiness . The default value is 60. I reduced it to 10. My machine barely swaps now. Performance is much better - and freezes and reboots don't happen anymore. # Set the swappiness value as root echo 10 > /proc/sys/vm/swappiness # Alternatively, run this sysctl -w vm.swappiness=10 # Verify the change cat /proc/sys/vm/swappiness 10 # Alternatively, verify the change sysctl vm.swappiness vm.swappiness = 10 The explanation is that Linux kernel maintains a cache of virtual memory pages in memory. It has to decide how to best use this cache and, for this, replaces vm pa...

Docker Build, DNS and CNTLM (Corporate Proxy)

Image
Was practicing the Docker Get Started Manual , and had to build the image: docker build -t friendlyhello . Got errors while trying to install Flask with pip , like in this Dockerfile line: RUN pip install - r requirements . txt Figured out it should be corporate proxy.  I have CNTLM  to help Ubuntu deal with TMG . Tried every variation of http_proxy=http://localhost:3128  . No luck. A few hours into the problem, found this thread . It nailed the problem: cannot use "localhost" becase the docker image will also have it's own "localhost". Replaced "localhost" by my desktop's IP and voilĂ : pip install worked perfectly. ENV http_proxy  http://XX.XX.XX.XX:3128 ENV https_proxy http://XX.XX.XX.XX:3128 Likewise, if the Dockerfile has to resolve a DNS entry, remember to add your DNS server to docker deamon , otherwise the default DNS entry 8.8.8.8 will be set and the docker build will not recognize  DN...

Mediawiki - Sticky Table Headers

Image
Have a table that requires scroll in a Mediawiki instance. Wanted the headers to show up while the user scrolls down. Gladly  someone developed  a  Sticky Headers Gadget . Very easy to install. The extension  Gadgets  allows to import scripts from others to add bits of functionality to Mediawiki. It comes bundled in version 1.27, only has to be enabled in LocalSettings.php (wfLoadExtension( 'Gadgets' );). Once the extension is enabled and the gadget installed, each user has to go to Preferences / Gadgets and enable the gadget. The result can be seen below.