Missing bash history in El Capitan

OK, bash history it is not exactly missing. El Capitan introduced "bash sessions" so history for each terminal session is saved in a separate file. Good old .bash_history file is not even there anymore. The annoyance here is that after you close your session and open a new one you can not access the history from you previous session. Also, I have no idea how to use the "bash sessions history" and do not want to waste time on exploring it. Fortunatelly the fix is simple – just create the .bash_history file and another file that serves as a "disable flag" – .bash_sessions_disable. Both in your home directory of course.

touch ~/.bash_history

touch ~/.bash_sessions_disable

Enjoy scrolling through your old commands.




Installing lxml on Ubuntu

To install lxml with pip on latest Ubuntu version you need a bunch of development packages installed first. 

sudo apt-get install -y python-dev libxml2-dev libxslt1-dev zlib1g-dev python-pip
sudo pip install lxml

These two commands should do the job.

Installing node.js on Debian 6 Squeeze

Unfortunatelly the Debian Squeeze package repositories do not include the node.js package, so the best way is to install from soures. I created a simple script that will let you install node.js with this one-liner :

sudo bash -c "$(curl -fsSL https://raw.github.com/kkoston/deb6-node-inst/master/go.sh)"

Just copy, paste and execute on your server. I am also hearing that recently released Debain Wheezy repos do not contain node.js package, so that should also work there. If you are experiencing problems with this script, make sure that you have git and curl installed on your system.


Auto sync disabled after upgrade to CyanogenMod 10.1

If your auto-sync was suddenly disabled after upgrade to CyanogenMod 10.1 (in my case that is the beta version) and you can see the annoying "Sync is OFF" message under you Google account settings, there is a simple way to re-enable it. Go to Settings->Data usage and press your phone's menu button. Select the "auto-sync data" option and that's it! It took me a while to figure it out as the placement of this option is completely counterintuitive.

Controlling cursor position in PHP CLI applications (and others)

I realized that this is still a frequently asked question on forums – how do I move the cursor in my PHP console application? The simplest way to do it in Unix based systems is to echo the terminal control escape sequence. This will work for any application or script capable of printing to the terminal.
For example, to move the cursor up 2 lines you would do:

echo "\033[2A";

So, if you want to create a simple counter:

for ($i = 1; $i < 11; $i++) {
    echo "$i\n";
    echo "\033[1A";

For the full list of the terminal control codes (escape sequences) for cursor and other features, like color – refer to this link:

If you need more comprehensive solution – take a look at ncurses library:

Android Synthesizer

My second take on Android SDK with NetBeans as a development platform.
A completely uncompleted sound synthesizer.
So far you can generate sinusoidal, triangular, sawtooth and square waveforms and mix them together.
You can play the sounds using little touch keyboard and switch across couple of octaves.
I think I should have used Java's piped streams to interconnect the components of the synth, so you can go ahead and improve it.
The nice part about the synthesis part is that I optimized it by basically generating one period of subaudible frequency
every time the waveform is altered and then just selecting every n-th sample, depending on frequency.
Saves a lot of CPU cycles.

Click here to download

Behringer Xenyx 802 pre-fader mod

I own a little Behringer Xenyx 802 mixer. It’s a nice and useful unit but it’s most annoying feature is the post-fader aux (FX) channel. Post-fader means that the audio signal level sent to the AUX send output depends on the level of the main channel fader. If you need the AUX (FX) channel to be totally independent you need to make it pre-fader. Pro mixers that come with multiple AUX buses may have some of them pre, some post and others switchable. The post-fader bus is usable when connected to effect loop. Effect level will depend on the channel level setting. Pre-fadeed AUXes are used for monitoring and other audio routing (recording mix may be different that FOH mix for example).
My case is a little different but also requires pre-fader AUX.
As a drummer, I also control the playback of pre-recorded stuff. At the same time I need a click. In the rehearsal or small gig setup I use condenser microphone to better hear the “room” and in the concert I grab the monitor signal over the DI Box. Therefore I have up to 4 tracks that need to be mixed into my monitor signal. In addition to that the playback signal (one channel) has to be sent to FOH or practive room PA system. This is where pre-fader AUX comes in handy.
I decided to do that for two stereo channels and left the mono channels unmodified. You can easily find corresponding connections for the mono channels. Doing it for the stereo channels my be also useful for DJ’ing and monitoring deck signals over AUX send output. This would in addition require using a stereo to mono headphones adapter.
The mod is pretty simple. As there is no schematics I used trial and error method and the multimeter to locate signals on the board. All you need is to solder in a summing resistor (I used 680R but I think 750R would be more accurate) between the direct pre-amplified signal signal and the input pin of the AUX pot. I don’t think this is the best way to do it but it works so I don’t really care.
Locate the R120 and R119 surface mounted resistors and solder the summing 750R resistor as pictured, to the middle pin of the potentiometer (three vertical pins between the R120/R119 resistors and the IC13/IC12) and the “bottom” pad pod the R120/R119 resistor.
Don’t overheat the SMD resistor pads as they can burn and lose contact. If you don’t know how to solder better practice first.
I’m not responsible for any damage of the equipment nor soldering burns and electric shocks you could receive while following this manual. Have fun.
Should you have any questions email me : chris [at)] koston.us

802 mod picture

802 mod picture