Sunday, February 14, 2016

How to enable graph style meters in htop 2.0?

The graph style meters added in htop 2.0 are really cool. You can see a sample in the htop homepage (at the moment anyway). In order to have one of those, go to setup (R2), then meters. Choose one of the meters (or add a new one) select it and hit space to change its style until it's on "graph".

Wednesday, November 11, 2015

Fixing VLC stutter on Android

VLC is a great player on the desktop, but my experience with it on Android has not been the best. Everytime I play start playing a track there's a delay and then a stutter. I can never hear the first couple of seconds properly. Worse this behavior continued for the entirety of an m4b audiobook I just tried to play.

Then I thought, why haven't I tried tweaking with the settings and see what happens. Sure enough, a few minutes later, I found a solution. Go to Preferences, then Advanced. Change Audio output from "OpenSL ES" to "Audio Track (Java)". Done! Everything is fine now.

Saturday, November 7, 2015

Fixing MTP mounting error in Ubuntu

I used to be able to mount my Galaxy S4 over USB but for some weird reason I started getting an error message a few days ago. Today I finally managed to fix the problem. First run lsusb to get the bus and device ID:

$ lsusb | grep -i samsung
Bus 002 Device 104: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-I9300 Phone [Galaxy S III], GT-P7500 [Galaxy Tab 10.1]

Now we know that the device is on bus 002 and its device ID is 104. Let's take a look at it:

$ ls -l /dev/bus/usb/002/104
crw-rw---- 1 mostafa audio 189, 231 Nov  7 17:23 /dev/bus/usb/002/104

For some reason, the device belongs to the audio group and I'm not part of that group. So I simply run:

$ sudo addgroup mostafa audio

Then I logout and login and the problem is fixed. As a temporary workaround, if you don't want to logout right now, you can run:

$ sudo chmod 666 /dev/bus/usb/002/104

Monday, December 29, 2014

How to get project version in waf

You know that line near the top of your topmost wscript file:
VERSION = '1.0'
so you want to get that in another wscript file? So did I. And after going through waflib code, this is the only way I could come up with:
from waflib import Context
version = getattr(Context.g_module, Context.VERSION) 
 
 
 

Friday, October 31, 2014

Converting a Raspberry Pi into a wireless access point

So I have a Raspberry Pi B+ and an RTL8188CUS based wifi dongle. I mostly used these instructions, but hostapd was not working so I did as this post suggests. I downloaded the custom RealTek hostapd, compiled and run it. Don't forget to update /etc/hostapd/hostapd.conf. This is mine:

# Basic configuration
interface=wlan0
ssid=Mistborn
channel=1
#bridge=br0
# WPA and WPA2 configuration
macaddr_acl=0
auth_algs=1
#ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=wireless1
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# Hardware configuration
driver=rtl871xdrv
ieee80211n=1
hw_mode=g
device_name=RTL8192CU
manufacturer=Realtek

That's about it.

Wired cannot ping wireless and vice versa

This was driving me crazy. My wired devices on the home network could not ping wireless devices, and wireless devices could not ping wired ones. I was going through the router options over and over. Firewall was disabled and so was user isolation. In the end, I found a "Multi-AP Isolation" in basic wireless settings. I disabled it and voila! Everyone can see everyone now!

Just for the record, the router was a D-Link DSL-2730U ADSL modem/router.

I also found out that I can ssh into my rooter with "root" as both username and password. Maybe I should try messing with it some time. Not today though!

Wednesday, October 29, 2014

Change attachment encoding in mutt

If you want to change the encoding used for an attachment while sending an email with mutt, choose the attachment and then press C-e. It then lets you type the content transfer encoding. You can find the possible values here.