Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, October 18, 2013

Why Language Specific Package Managers Exist

This post has moved! Click here to view the new home of this post.

If you are a developer for any language but C, you have probably seen language specific package managers; pip, luarocks, gem, easy_install, the list goes on. But while they may be convenient in the short term I will explain why they suck, and why they are necessary.

Friday, August 23, 2013

Using Systemd to Manage User Sessions

WARNING: This process doesn't work any more. Systemd user sessions are still experimental and volatile and this method no longer works.

If you haven't heard of systemd you should take a look. Basically it is a new /sbin/init process (PID 1). But systemd doesn't stop there, it can also be run as a user to manage arbitrary processes. This article is about replacing the session-manager that comes with your desktop environment (gnome-session, xfce4-session...) with a full-featured process manager.

Friday, August 9, 2013

File Renaming Trick

This post has moved! Click here to view the new home of this post.

For a lot of you it may be pretty obvious but I want to share a quick trick I thought of just now. Often I find myself renaming a file in a sub-directory and find it a pain to type the whole path twice.

mv my/long/path/file.txt my/long/path/newname.txt

However you can use shell expansion to make this easier.

mv my/long/path/{file,newname}.txt

I never thought of it earlier because I think of expansions like when creating multiple arguments of they same type (soruce files, packages to install...), but since the order is predictable it works well for specifying the from and to arguments for the mv and cp commands.

Thursday, June 13, 2013

Why You Shouldn't Be Concerned By Government Surveillance

This post has moved! Click here to view the new home of this post.

Recently I have been hearing a lot about government surveillance in the USA. My initial thoughts were very negative because I feel that my personal data should be kept private, but after some thought I realized that it is my fault for trusting these companies, who for "legitimate" reasons may need to turn my data over to the government. If I trust them that far I shouldn't be too surprised when they turn that same data over without a proper request from the government.

Throughout this post I will be discussing ways to keep your information private no matter what these laws allow.

Wednesday, January 30, 2013

Thoughts on Ubuntu

This post has moved! Click here to view the new home of this post.

When I started in the linux world my first distribution was Ubuntu. It is a great distribution for new users and I still recommend it in that situation. Unfortunately, Ubuntu has shifted from a linux distribution to a a giant set of patches and unportable software. While this may be the simplest way for Ubuntu to release their OS is the the most hazardous to the linux desktop.

The number of patches is the reason I left to Ubuntu, reporting bugs was a nightmare because you didn't have ProgramY 1.23, You had ProgramY 2.23-ubuntu (or more likely ProgramY 2.19-ubuntu because they are terrible at keeping the programs up to date because they have to check all of their patches). This isn't that big of an issue for applications but the libraries are all of custom and some programs don't work, or they only work on Ubuntu. Instead of working with the original developers of the libraries to fix the problems and implement the features they need they pretty much fork all of the software they need. This means that Ubuntu isn't helping the community, only making sure their OS works.

This is only the tip of the iceberg. Why I have been referring to Ubuntu as an OS rather than a distribution is because that is what it has become. An example of this is the Unity desktop. With the Unity desktop they created a bunch of API's that were very similar to what is already standard on linux. Instead of expending and updating these API's they create their own, now to properly integrate with the most popular linux desktop you need to use non-standard API's and your app has problems running on other distributions of linux.

I see Ubuntu becoming like Windows or Mac. Yes, it is opensource, but there is still so much proprietary content that you are beginning to get Ubuntu apps and linux apps. This locked-in mentality is hurting the linux ecosystem as much as it is helping it by bringing more users.

After all I have said I don't think it is too late for Ubuntu. They need to write a bunch of standard API's for everything that they have created and push all of their improvements to other software back upstream, Ubuntu needs to become a distribution again, a collection of software being put together rather then a bunch of custom stuff. An example is their cloud integration where you can use address books from online services. This should have been implemented as a portable library with standard ways to add and access these services so that it could be used on all linux distributions. That way, instead of having Google contacts on Ubuntu you can have a google contact service that can be used on any distribution and other contact services can be added as backends without having to work their way into Ubuntu code bases. Also, more people would write software to these interfaces because they don't have to worry about limiting their audience. This way everyone wins, which is one of the key benefits people get from free software.

Friday, December 21, 2012

Free Chunk Recieved!

I while ago I signed up for a free VPS server at ChunkHost. After a long time of not hearing anything from them I received an email telling me that my "chunk" has been activated. I sshed in and did some simple tests to see how it was.

I didn't do any CPU test as they wouldn't be too meaningful. This is because you can burst to full "dual quad-core energy efficient 2.2GHz AMD processors" if no one else is using them. So I could be measuring what I am restricted to what I am allowed or I could use the full power. There is a lot of information in their FAQ.

The first thing I measured was ping time.

root@kevincox:~# ping google.com
PING google.com (74.125.224.166) 56(84) bytes of data.
64 bytes from lax02s01-in-f6.1e100.net (74.125.224.166): icmp_req=1 ttl=59 time=0.424 ms
64 bytes from lax02s01-in-f6.1e100.net (74.125.224.166): icmp_req=2 ttl=59 time=0.641 ms
64 bytes from lax02s01-in-f6.1e100.net (74.125.224.166): icmp_req=3 ttl=59 time=0.501 ms
64 bytes from lax02s01-in-f6.1e100.net (74.125.224.166): icmp_req=4 ttl=59 time=0.645 ms
64 bytes from lax02s01-in-f6.1e100.net (74.125.224.166): icmp_req=5 ttl=59 time=23.6 ms
^C
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 0.424/5.172/23.653/9.240 ms
Half a millisecond to another quality service is very reasonable. Next I pinged from my house in Canada to the VPS.
$ ping $myvps
PING $myvps ($myvps) 56(84) bytes of data.
64 bytes from $myvps: icmp_seq=1 ttl=50 time=101 ms
64 bytes from $myvps: icmp_seq=2 ttl=50 time=100 ms
64 bytes from $myvps: icmp_seq=3 ttl=50 time=98.4 ms
64 bytes from $myvps: icmp_seq=4 ttl=50 time=99.4 ms
64 bytes from $myvps: icmp_seq=5 ttl=50 time=105 ms
^C
--- $myvps ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 98.415/101.268/105.968/2.635 ms
$ ping google.ca
PING google.ca (74.125.226.24) 56(84) bytes of data.
64 bytes from yyz06s05-in-f24.1e100.net (74.125.226.24): icmp_seq=1 ttl=56 time=14.5 ms
64 bytes from yyz06s05-in-f24.1e100.net (74.125.226.24): icmp_seq=2 ttl=56 time=13.5 ms
64 bytes from yyz06s05-in-f24.1e100.net (74.125.226.24): icmp_seq=3 ttl=56 time=16.5 ms
64 bytes from yyz06s05-in-f24.1e100.net (74.125.226.24): icmp_seq=4 ttl=56 time=11.2 ms
64 bytes from yyz06s05-in-f24.1e100.net (74.125.226.24): icmp_seq=5 ttl=56 time=10.2 ms
^C
--- google.ca ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 10.252/13.226/16.524/2.266 ms
While it is not nearly as good of a response time as Google gives me they have servers all over and I am getting one of the closest ones. From Toronto to Los Angeles 100ms is not unreasonable, I am quite happy with these results.

Next I went for a network throughput. I downloaded a large file from a CDN to see what download speed I could achieve. I don't know the speed limit of the CDN is but here are my results.

root@kevincox:~# wget http://cachefly.cachefly.net/100mb.test
--2012-12-21 17:23:54--  http://cachefly.cachefly.net/100mb.test
Resolving cachefly.cachefly.net (cachefly.cachefly.net)... 205.234.175.175
Connecting to cachefly.cachefly.net (cachefly.cachefly.net)|205.234.175.175|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: `100mb.test'

100%[======================================>] 104,857,600 7.26M/s   in 13s     

2012-12-21 17:24:07 (7.72 MB/s) - `100mb.test' saved [104857600/104857600]

I also performed a very simple file copy test.

root@kevincox:~# time cp 100mb.test 100mb.testcp

real 0m2.948s
user 0m0.012s
sys 0m0.476s
That is a 100mb file in about 3s. That comes out to about 35mb/s, not too impressive. I ran this a number of times and this one was about in the middle although I got as fast as 2s and as slow as 6, which is a little worrying.

Lastly I am going to mention the specs you get for free. You get 128MB of RAM 3GB of disk space and 35GB of bandwidth. The dedicated CPU you get is proportional to the amount of RAM you have. Since you have 1/8Gb of RAM out of their 32Gb machine you get at least one 256th of the CPU which isn't a lot. Luckily they do have a referral program and the option to buy upgrades. The link I put at the top of this article was my referral link and if someone uses yours you can get upgrades to RAM (and CPU), disk space and bandwidth. If you get 30 referrals you can get a very capable machine at 2Gb RAM, 30Gb disk space and 600Gb of bandwidth, which isn't bad for a free VPS. Of couse you could always upgrade to one of their paid plans if you find you need more

That is the end of my very simple benchmarks, I would recommend trying it out as you have nothing to lose. You will need a facebook account to sign up (they are trying to prevent multiple accounts). I have a couple of ideas for my new VPS. If you want to sign up here is the link once again. Remember that it took a couple of months for them to activate mine, so don't expect anything soon.

Sunday, November 4, 2012

How to Run XScreensaver as root with Locking

XScreeensaver must be one of the coolest programs ever, many of the "hacks" (screensavers) bring me nerdy delight. Unfortunately, do to security reasons it can't lock the screen as root. I understand this and think it is a good thing not to provide a false sense of security. However, understanding that the locking is not really secure I just wanted something that would prevent my friends from posting things to my facebook on the computer that I run as root (yes, I know I shouldn't).

Sunday, June 17, 2012

Welcome Back GNU! My Revenge on Android

In my last post I discussed that the lack of GNU on android devices was limiting the software available and didn't bring new libraries to linux. Unfortunately for me I don't have a MeeGo device and am stuck with the Java beast.

One of the things that bothered my the most was that I could not sync my music using Unison like I do across my other three computers. If I was on MeeGo it would be as simple as apt-get install unison.

The solution for this was installing GNU on my phone, the basic concept is that you have a Linux kernel so if you install the user-land you can simply chroot into that environment and enjoy the true GNU/Linux experience.

Linux on Mobile Devices, "You're Doing it Wrong"

To start off, I would like to clarify what I mean when I say "Linux".  In the title, I meant all forms of Linux, both the kernel and the GNU/Linux OS.  From now on I will explicitly say the Linux kernel and when I just say "Linux" I am probably referring to the GNU/Linux OS.

The most popular form of "Linux" in the mobile space is Android.  Android is not really Linux but a Java OS running on a Linux kernel.  So what's wrong with that?  The fact is that we are developing drivers and applications that run off of Android instead of Linux.  Very simply, we are doing more work than we have to and we aren't letting our work be used in more that one place.  I know, you could run Android on your desktop and when that happens the situation will be a little better.  The fact is that we are doing more work for less gain, wasted man hours.