Skip to main content


Showing posts from September, 2015

ipython && tmux - saving history to a file

Hey, I had an ipython console open inside a tmux split window and I needed to save the history to a file. Since I can't copy & paste the data from the screen (I was in the middle of a session, so the next time I would configure it correctly using  this ). So I found a quicker way,  Roberto Z  wrote in his comment  that in order to save the session's history you can use readline  package: import readline readline.write_history_file('/home/user/current_history') This works like a charm in Ubuntu. - Tal Kain

Linux: iptables: Removing a collection of iptables rules at once

Here is a small trick for removing several iptables rules at once, Let's assume we would like to add some rules: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE I can use the comment match and add a comment to this line: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE -m comment --comment "SOME_COMMENT" Now, cleaning all the relevant rules in a simple command would be: # iptables-save | grep -v SOME_COMMENT | iptables-restore  Probably not the best way to do it, but it's simple and fast. Have fun, -Tal Kain

Installing NVIDIA CUDA on an Amazon Web Services (AWS) machine (Ubuntu 14.04)

Disclaimer: I wrote this post several months ago and did not publish it for unknown reason, I assume that the information below is still relevant and correct. While trying to install the machine, I started my research by reading  Traun Leyden 's great blog post:  (you should too) Amazon offers two types of machines that includes GPUs ( ) High-performance NVIDIA GPUs, each with 1,536 CUDA cores and 4GB of video memory While writing this post, I used the  g2.2xlarge  machine, but you can also use the 8xlarge. This will be quick and simple: 1. Make sure you are fully up-to-date sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade  When prompted, choose the "install maintainer package...." 2. Reboot the machine (so it will load the new kernel) 3. Install the kernel's header f