Adding a row to matrix with numpy

Needed to convert a one dimensional array to a two dimensional numpy matrix and then add a row vector to the end of the matrix. import numpy array1d = range(10,100) array2d = [array1d[i:i + 10] for i in range(0, len(array1d), 10)] newline = [88 for i in range(1,11)] m = numpy.matrix(array2d) m_extended = numpy.vstack([m, newline])

Atom editor on Ubuntu

To Install the atom editor for Linux (taken from here): $ sudo add-apt-repository ppa:webupd8team/atom $ sudo apt-get update $ sudo apt-get install atom I needed syntax highlighting for Lua. My suggestion is: Start atom, press <Ctrl><Shift>P Type: install packages Select ‘Settings View: Install Packages’ Search for language-lua package install the language-lua package You should get …

Continue reading ‘Atom editor on Ubuntu’ »

Ubuntu 14.04 LTS very slow on VirtualBox

Got the solution from here: Shut down the guest machine Select the Ubuntu 14.04 virtual machine and click the Settings button Select the ‘Display’ item from the list on the left In the Video tab on the right, check the ‘Enable 3D Video Acceleration’ option Select the ‘Storage’ item from the list on the left …

Continue reading ‘Ubuntu 14.04 LTS very slow on VirtualBox’ »

VirtualBox, Ubuntu Guest, Shared folders

Assuming your Ubuntu guest username is USERNAME: Make sure you have already installed the VirtualBox Guest Additions in the Ubuntu guest machine From the Ubuntu guest: sudo adduser USERNAME vboxsf Using the VirtualBox UI (Devices->Shared Folder Settings…) add the folder in the hosting machine that you wish to share. Restart the Ubuntu guest! (wasted too …

Continue reading ‘VirtualBox, Ubuntu Guest, Shared folders’ »

Sniffing HTTP and HTTPS traffic to understand app protocols

I needed to understand the protocol between an iPhone application and the server. There was no written documentation and the company that owned the application wanted me to build something based on the protocol. The first thing I tried was using squid as a proxy to intercept the protocol between the iPhone application and the …

Continue reading ‘Sniffing HTTP and HTTPS traffic to understand app protocols’ »

Speeding up MySQL imports from mysqldmp

If you need to import a very large SQL dump file to MySQL, the following should speed things up considerably: At the begining of the SQL dump file, add: SET autocommit=0; SET unique_checks=0; SET foreign_key_checks=0; and at the end: COMMIT; Then proceed as usual with the import, i.e mysql> source myfile.sql

Errors installing Ubuntu guest additions on VirtualBox

If you mount the guest additions and see a warning about missing kernel headers, and the additions don’t seem to work, and then after trying to launch the guest additions CD again you get VERR_PDM_MEDIA_LOCKED error and everything starts going downhill from there – this is the solution that worked for me: 1. Reinstall Ubuntu …

Continue reading ‘Errors installing Ubuntu guest additions on VirtualBox’ »