Wifi issues

This is something that I already dealt with about a year back but it has come again to hunt me. A year back I tried to make use of an old laptop (An IBM T23 to be exact) and install linux on it. The laptop doesn’t have any internal wifi card so I went with an old wifi usb drive. But that thing was already hard to use on windows so getting it to work on linux was a whole different story. First I needed ndiswrapper to get the windows driver to work. But that didn’t do the trick so I went ahead and asked on the Arch linux forums. In the end I dug up a solution which worked for me back then.

A year later I dig up another laptop (An IBM T41 this time) and tried the same procedure. Sadly the thing that did the trick last time wasn’t the whole solution. After some more careful reading of my old thread I put together what is needed to get a wifi pci card or a wifi usb drive to work on an old ibm with linux:

First you need ndiswrapper. For Arch it’ll look like this:

$ sudo pacman -S ndiswrapper

If you have issues running ndiswrapper later you might need the linux headers:

$ sudo pacman -S linux-header

Next up we need to install the driver:

$ sudo nidswrapper -i <driver>.inf

The *.inf file is usually distributed with the driver, sometimes it’s inside the *.exe which means you’ll need to extract it using cabextract.

Now you want to plug in the device of which you just installed the driver and run

$ ndiswrapper -l 

This will list all installed drivers and wether or not the device is present. If it says so the driver is correct and the device is recognized. Now with most devices the last thing you want to do is load ndiswrapper on startup using

$ sudo ndiswrapper -ma

And since this is your first time using it you’ll have to load it manually once:

$ sudo modprobe nidswrapper

Now the device should be ready to use and you can connect to your network using a network mananger or wpa_supplicant. But for me this wasn’t all that was needed. What I need to do is disable ipv6 by editing /etc/sysctl.d/40-ipv6.conf

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.<wifi device>.disable_ipv6=1

You can find the device name by typing ip link and for me it was the last listed device. The next thing to do is add these two lines to /etc/dhcpcd.conf

noipv6rs
noipv6
# Also comment out the line that says something like 'ipv4all'

Now this command has to be executed on every startup:

$ sudo dhcpcd <wifi device> --nohook mtu
# Once again get the wifi device with ip link

Now finally we’ll generate a wpa_supplicant config using

# wpa_passphrase <Networkname> <network password> /home/<username>/wifi.conf

You can get your exact Network name by scanning for networks over:

$ sudo pacman -S wifi-menu
$ sudo wifi-menu

Don’t use wifi-menu to connect (It’ll probably not work, but you can try).

Finally we can use the config to connect via wpa_supplicant:

sudo wpa_supplicant -D wext -B -i <wifi device> -c /home/<username>/wifi.conf

To automate the connection you can follow the Arch wiki or create a service.

And that’s it, wasn’t all that hard, right? ūüėõ

Livestreamer without commandline

Update: Livestreamer has been discontinued and has bin replaced by StreamLink. So everytime I mention livestreamer just imagine I’m talking about StreamLink. It’s a fork of it and works exactly the same.

Now that my adventures on linux are over for a while I realized that some things are a lot harder on windows than on linux. For example: I use livestreamer (Now Stream Link) to watch livestreams in VLC.

VLC playing a livesteam over livestreamer

Originally because I wanted to avoid the Flash player and now that almost everyone has switched to HTML5 I use it only for convenience. On linux I started livestreamer like this:

$ livestreamer high & disown

Which allowed me to close the command line afterwards. Sadly windows doesn’t work that way so I always have to leave the cmd window open. But when something’s annoying enough I’ll fix it at some point and with this problem it’s possible over a *.vbs script.

This is the script I’m using (pastebin.com):

Dim streamer
Dim quality
Dim link

streamingSite = “twitch.tv”¬†¬†¬†¬†¬†¬† ‘ The Site you want to grab the stream from
default ¬†¬† ¬†¬† = “gamesdonequick”¬† ‘ The stream that is shown by default in the text box
defaultq¬†¬† ¬†¬† = “high”¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†¬† ‘ The default quality

streamer = InputBox(“Enter livestream channel”, “livestreamer”, default)
quality¬† = InputBox(“Enter quality”, “livestreamer”, “high”)

link = “livestreamer ” & streamingSite & “/” & streamer & ” ” & quality & ”¬† –http-header Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6″

CreateObject(“Wscript.Shell”).Run link,0,True
Set objShell = Nothing

Just save it as a *.vbs file and change the three variables to fit your needs and when launching it you should see this:

After clicking ok on the second dialog it’ll take some time, and if Livestreamer is installed correctly and finds a player (eg. VLC) you should see the player opening with the livestream and no command line. The last thing I did was make a shortcut of it and give it a nice icon.

Windows 10

So I have avoided windows 10 ever since the tray icon showed up for everyone for the free upgrade. The furthest I’ve gone away from windows 7 was 8.1. Since my windows 7 installation was getting kinda slow I decided to make a clean installation, and while I’m at it I thought I’ll go ahead and, for the first time, install windows 10 outside of a virtual machine.

The installation went smooth and I only had to untick about 300 settings about “collecting data to improve my experience”. After the main installation I went ahead and ran a few scripts to disable the rest of the services and I think I now a have a relatively useable installation of windows 10. So after I installed the basic software I need (which I heard can be automated using ninite or allmyapps, but I haven’t tried them) I went ahead and looked at some customisation with designs. There were some pretty cool looking ones but sadly one of them ended up toasting windows and trying to fix it only made it worse. Luckily I made a backup so that helped out a lot.

So after almost loosing my first installation of windows 10 about 2 hours in I stopped with the designs and installed something I knew from windows 8.1: Classic Shell, the free StartIsBack. It gives you a way to customize (or for windows 8 bring it back) your startmenu. The windows 10 start menu is way to big and full of useless stuff in my opinion so with classic shell you’ll get back the windows 7 styled start menu with a skin to fit the flat design of windows 10. It’ll also give you the search bar back and it’ll adjust to the accent color.

Due to the roll back to the backup I lost some software I had already installed, including winamp which was my goto music player for a while now. So I thought I’d use ths opportunity to give foobar a try but quickly dropped it since I didn’t like the interface and installing skins didn’t really work for me. But while looking for skins I found out about AIMP. I’ve never heard of it but I found a cool skin for it and it offers a lot of customization while staying very light weight (at least in terms of RAM usage).

So this is what my current installation looks like:

Classic shell and AIMP with the ncmpcpp skin

That’s basically it. We’ll see how long I can stick with it until I get annoyed or maybe to my surprise I’ll actually stay who knows.

Styling Firefox

A while ago I found out about the firefox addon stylish. It’s an addon that allows you to change the look of your browser and specific websites. Unlike themes it can completely redecorate almost all elements like the url bar, bookmark bar etc.

A small side note: The addon has sadly been bought by a big company. This is not the first time this has happened to an addon, but sadly this means using the addon will send information to that company, since that’s pretty much the only reason they bought it. Currently this is only enabled in chrome and can be disabled under the settings. An update for firefox will probably follow at some point, but I doubt that the option to disable the information collection is here to stay. So use this addon only if you’re okay with sharing some of your data (which I am not). There’s an alternative for chrome called StyleRRR (Chrome/Firefox).

On userstyles.org you can browse website and browser styles. I for one installed DarkTube so the YouTube design is easier on the eyes. So yeah with stylish you can have dark themes for most popular websites which don’t natively support it.

YouTube with the DarkTube theme

So since only making YouTube darker is kinda lame i also wanted firefox to be more darkish and more flat. So after some searching I came across powerline. Which is pretty cool, but the theme doesn’t include the bookmark bar nor the addon icons. But with my amazing css skills and some googling I modified powerline to fit my needs.

Firefox with my modified version of powerline

So as you can see Firefox is now entirely dark themed. The tabs look a little bit like those from chrome and they take up 100% of the window width, devided evenly to all open tabs. The url is centered at the top and on right are the icons from my addons. It’s not perfect but it does the trick.

So if you want to try my version you can get it here. Just copy the css text, make a new style under about:addons and paste in the text.

MPD Query

So I mentioned in another post that I use mpd and ncmpcpp to listen to music. The positive thing about this is that I can just close ncmpcpp when I don’t need it anymore and the music will continue playing, since mpd is responsible for the sound which is running completely in the background. Now sadly I have no indicator about what song is playing right now.

So I looked if anybody made a patch for dwm to display the current song, but everything I found didn’t really work for me. And I didn’t want a bash script to be running in the background. So I found a few people suggesting to make a simple C program to query the current song.

Now this is easier said than done, since I have no idea how to use mpd and C. The first thing I did was download the source code of mpd and copied the include directory into my project folder. So now I can write a program utilizing code from mpd. Now for the tricky part: Getting my program to connect to mpd and get the song name and some other information. I had some example code which showed how to connect and get the play time of the current song, so that helped a little bit, but getting the song name doesn’t work the same way.

For experienced people this task probably would be a thing of ten minutes but I not only had to deal with how mpd worked I also had to figure out how C works. And most time that was me writing like three lines of code, compiling it and finding out it compiled fine but crashed when running. So here’s what I have done so far:

Created a Makefile where the include directory (which containes the headers of mpd) is:

Makefile

VERSION = 3.02
CC      = /usr/bin/gcc

mpdq: mpdq.c
    $(CC) -o mpdq -lmpdclient mpdq.c

So this way compiling is just the command ‘make’. Next up is writing the actual code which started by me finding out how the main method looks in C and then moving onto actually fiddling with mpd. To work with mpd I needed these two headers:

#include <mpd/client.h>
#include <mpd/stats.h>

When those are included and the compiler doesn’t complain about not finding them you should be able to access the necessary methods to connect and query information from mpd:

struct mpd_connection  *connection = mpd_connection_new(NULL, 0, 0);

This will open a connection to the local mpd and return the pointer to the connection if it succeeded. The three arguments are only needed if the connection is to another computer. After that we want to get the current song and from that we can read most Song tags:

// Get current song as a struct
struct song = mpd_run_current_song(connection);
// Read name and artist
char *song_name   = (char *) mpd_song_get_tag(song, MPD_TAG_TITLE, 0);
char *artist_name = (char *) mpd_song_get_tag(song, MPD_TAG_ARTIST, 0);

And that is technically everything important to read information from mpd. The only other things I did were putting this in a loop, adding a command to make it appear in the dwm bar, differentiating between paused/playing and¬† cleaning up when closing. That’s all I have done up until now. I’ll see if I can get some controls like pause/play into the dwm bar but for now this’ll suffice.

DMEDYKJ

Here‘s the source code and here‘s a binary build. Just give it the run flag with chmod a+x and when running it should display the current song in the top left corner (Provided you use dwm and a song is playing in mpd :P).

Rocket League on Linux

So recently Rocket League got a linux version, which is currently in beta. But since I’m currently using Linux more than windows I thought I’d give it a try.

On Windows my controller just works when plugged in and is directly configured correctly. On linux, sadly it needs a little more work. Nothing surprising. So what I did was look around and found out that the default driver for controllers and joysticks, xpad, does not support Xbox controllers and any controllers that mimic them. Mine is some cheap Xbox 360 knockoff but it works just like an original one and I never had any issues on Windows.

So for linux, you’ll need a custom driver called xboxdrv. For the arch linux users, you can get it on the AUR here. I suggest you use an extention for pacman to support the AUR like yaourt, which makes installing software from the AUR a whole lot easier.

So when I got my hands on xboxdrv I started it as root (which is required) just to find out that Rocket League does not like it. Loading the driver works perfectly and programs like PPSSPP or other games work just fine. But in Rocket League I had several problems like constanly going in reverse without pressing any button, constantly looking up and other strange mismappings for the buttons. So after a lot of googling I stumbled upon someone else who happened to have issues with Rocket League and his controller as well. He posted his config for xboxdrv, which I promptly tried out and reduced to the important part. And with that config it worked perfectly without any issues and the exact same button mappings as on windows.

So here’s what I did:

Write this to a config file e.g. /home/username/xboxdrv.conf

[xboxdrv]
 silent = true
 mimic-xpad = true

and then run xboxdrv with the config:

$ sudo xboxdrv --detach-kernel-driver --config /home/username/xboxdrv.conf

And that’s it you can set it up so the driver runs in the background as a daemon but I’m waay to lazy to do that since I only need it for Rocket League ūüėõ

tox

So my schedule for writng these things is rather random and so I thought I just I’d write about this pretty interesting tool: tox or rather utox. Tox is a chat protocoll which is focused on being fully encrypted and decentralized. Making it a very good alternative to other services which do not provide this level of security and privacy.

Tox is opensource and thus allows everyone to make their own chat client. The one I use is utox. It’s a lightweight program that runs on all major operating systems including mobiles.

uTox offers a bright and dark theme

Another goal of tox clients is to offer a zero configuration experience. No installation process and no setup time, just launch it and it works. When launching any client that uses the tox protocoll you’ll get a tox ID. This is what other people need to add you as a friend. The ID is a ~76 character long string consisting of letters and numbers, so it’s rather hard to remember but if you’re using uTox you can get yourself a tox ID which looks something like this: username@utox.org. That way people have it easier adding you.

Now the cool thing about tox that it isn’t limited to text, it allows you to quickly share screenshots of your desktop or just any file you have laying around with no maximum file limit. You can also do voice calls or video calls, in which you can use your desktop as a video input to share your desktop. Those things can also be done with multiple people in a groupchat.

Left: uTox on Linux / Right: Antox on Android

So to sum it up it’s a pretty useful tool that doesn’t hurt to try out. It’s still in early development though so you’ll experience some bugs and missing features.

btw my tox id is universal@toxme.io