Linux
Anything I post related to Linux (i.e., most of my posts).
New Desktop Theme
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
Just in case anyone is interested, here is my new desktop layout.
This theme works with 1280x800 screens. (If you have a different size screen, you will have to modify it)
Download: theme.tar.gz
Font: Droid Sans
Panel: tint2
- Install from this PPA
- The tint2rc file (from my theme package) to “~/.config/tint2/”
Background: custom (includes panel and conky backgrounds)
- Either use my background (background.png) or replace the background layer in background.xcf with your own image and save it as a png.
Conky:
System Information and Calendar.
You can find them in the theme package.
To install:
- Create a new folder “~/.conky/”
- Copy “cal.conkyrc”, “cal.py” and “system.conkyrc” to “~/.conky/”
- Add a new startup item
sh -c "conky -d -c ~/.conky/system.conkyrc; conky -d -c ~/.conky/cal.conkyrc"
Theme:
- Metacity: Nooto
- GTK2: Ghostship
- Icons: Elementary
Apt Repository Permissions
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
I just posted a solution to this idea but thought that I should share it here.
Here is the problem: In order to get the latest features on Ubuntu, people are adding a lot of PPAs. For now there hasn’t, as far as I know, been a case in which a PPA owner has uploaded a malicious package but this is a possibility. Uploading an end user application, such as shutter, with malicious code would be problematic but not devastating. On the other hand, uploading a malicious sudo package would be devastating. Here is my solution.
Different repositories would “own” packages:
- Ownership would be set in a file such as /etc/apt/ownership/.list
- A special system packages file would be created that would designate system packages (sudo, pam etc…).
Apt repositories would have permissions:
- Ultimate Trust: Update and Install packages from this repository regardless of ownership including system packages.
- All: Update and Install new packages from this repository regardless of ownership (except system owned packages).
- Owned only: Update and install only owned packages.
- No Updates: Install owned packages from this repository but do not download updates from it.
Flags:
- Warning: There would be a warning flag that a user could set on a repository that would warn when packages are updated or installed from that repository.
- System: There would be a system flag that could be set on security related packages (sudo, bash etc…) that would prevent all but “Ultimate Trust” repositories from installing/updating them.
Navigate text with vi(m) keys on linux
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
Intro
Lifehacker recently posted a AutoHotkey script for windows that allows text navigation using letters instead of the arrow keys. In response to @wersdaluv’s post, I wrote a very simple script that allows users to navigate text using the standard vim keys (hjkl) when the caps-lock key is toggled. Feel free and add to my very basic script.
Steps
I stored the script referenced in this post in a paste-bin and now it’s gone. Live and learn…
- Download my script (via copy and paste) from
here. Lost (email if found). - Save the script somewhere where you will not delete it and mark it as executable (
chmod u+x /path/to/script.sh
) - Add the script to the startup programs with the argument
init
(i.e./path/to/script.sh init
). If you don’t know how to add startup programs in your Desktop Environment, Google it. - Assign F13 (the now remapped capslock key), as a hotkey in your window manager. Set the command to
'/path/to/script.sh toggle'
. Again, if you don’t know how to add a hotkey, Google it. - Now either log out and then in or run ’
/path/to/script.sh init'
in order to remap the capslock key. - Pressing the capslock key should now toggle navigation mode.
Bash completion with aptitude aliases
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
Problem
- If I used my alias for installing an application (
inst application
), I would have to know the full application name because I would not have bash completion. This was very annoying when installing libraries because they often have weird version strings tacked on to their ends. - If I used the full command (
sudo aptitude install application
), I would have bash completion and would therefore not have to know the whole application name. I could simply typelibxul
and getlibxul0d
.
On one hand, I would type a short command plus a complected application name, on the other I would type a long command and a simple application name. I wanted to be able to type a short command with a simple application name.
Solution
I wrote my own bash completion rules. They are based on the default aptitude bash completion rules but customized for aliases.
# Install Completion
#
_aptitude_all()
{
local cur dashoptions
COMPREPLY=()
cur=`_get_cword`
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \
--with-recommends --with-suggests -R -G \
--without-recommends --without-suggests -t \
--target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused'
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
else
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
fi
return 0
}
_aptitude_installed()
{
local cur dashoptions
COMPREPLY=()
cur=`_get_cword`
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \
--with-recommends --with-suggests -R -G \
--without-recommends --without-suggests -t \
--target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused'
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
else
COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
fi
return 0
}
complete -F _aptitude_all $default inst
complete -F _aptitude_all $default upgrade
complete -F _aptitude_all $default apt-info
complete -F _aptitude_all $default apt-changes
complete -F _aptitude_all $default apt-download
complete -F _aptitude_installed $default uninst
complete -F _aptitude_installed $default reinst
complete -F _aptitude_installed $default purge
Just copy it into a file such as ~/.bash_completion
and source the file in your ~/.bashrc by adding “. ~/.bash_completion
”.
Change/Add/Remove the aliases at the end of the file. The lines that start with complete -F _aptitude_all
complete any available or installed package and lines that start with complete -F _aptitude_installed
complete only installed packages.
inst, upgrade, apt-info, apt-changes…. are my aliases. You must use YOUR ALIASES for this to work. To add aliases, read this.
How to invite someone to Ubuntu One
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
For anyone with an Ubuntu One account, the following are instructions for sending invites:
- Go to My Files in the web interface.
- Create a new folder (to be shared) with the person that you will be inviting
- Go to the sharing tab (on the right).
- Share the folder with the person that you want to invite (The trick is that someone does not have to have an Ubuntu One account to accept a share).
For anyone looking for an invite, just ask @bugabundo at Identi.ca.
Grdc - A very good graphical VNC viewer for the average linux user
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
Overview
After finding myself frustrated with Vinagre’s (GNOME’s standard VNC viewer) lack of ssh tunneling support I began looking for an alternative. I finally found it: Grdc.
Grdc supports both VNC and RDP. Grdc can tunnel both connections over ssh for security. The ssh tunneling supports key based or password based authentication and allows the user to select a custom server and port (if they differ from the defaults).
Grdc’s user interface is much simpler than that of Vinagre. It allows the user to create and save custom connections and organize them by groups. Its connection quality settings are, unlike many remote desktop programs, quite simple. The user simply chooses the quality and the number of colors. Grdc also has a panel applet for the gnome-panel that lets users connect to their saved connections through a simple menu.
Another interesting feature is the “VNC Incoming Connection” protocol. This protocol lets users create new VNC servers with custom ports and passwords on the fly. This is especially useful if a user wants to let a remote user temporarily control their desktop.
Grdc does not support everything. It does not support tabbed connections like Vinagre but, in my opinion, tabbed connections are overkill for most users. It also does not support browsing a network for VNC connections with avahi as Vinagre does. This feature would be useful for administrators but is somewhat useless for the average user because most users will access the computer from the internet, not the LAN, and thus avahi support would be pointless.
Overall, Grdc is good for remote, internet traversing connections because of its ssh support and is useful to the average user because of its simplicity. Vinagre is still a better VNC client for administrators that have to manage many computers over a LAN because, on a LAN, encryption is usually unnecessary while avahi support is helpful and, when managing multiple computers, tabs are very helpful.
For screenshots see the SourceForge Screenshot Page
Installation
As of the writing of this post, the version of Grdc in the ubuntu repositories is woefully out of date and does not support ssh tunneling. Therefore one should use the deb provided by the project maintainers on sourceforge. Simply download the grdc deb (link below) and install (usually just double click). The grdc-gnome package is the gnome-panel applet and the grdc package is the main program.
Downloads: http://sourceforge.net/project/showfiles.php?group_id=248852
Homepage: http://grdc.sourceforge.net/
– Edit: I have packaged a 64bit version. Download here.
– Edit 2: The 64bit version of grdc-gnome (the panel applet) for karmic seems to work in jaunty. Download here.
How to record one's linux computer with pulseaudio
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
I posted a simple tip to an Identi.ca user (mxc) explaining how to record a skype conversation and felt that others might find the information useful. Here is an elaborated explanation of how to record the sound from a linux computer.
- Install pavucontrol and the gnome-sound-recorder (in the gnome-media package).
- Open the gnome-sound-recorder and start recording
- Open the pulseaudio volume control and switch to the recording tab
- Click on the down arrow of the “gnome-sound-recorder” Record Stream, Select “Move Stream” and move the stream to the “Monitor” stream for your sound card.
This should record all sound from your computer if you are using pulseaudio. I have not tested this with skype but it should work.
Identi.ca feed fetcher script
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
Attached is a simple Identi.ca feed fetcher script written in python. It is a console program and has no gui. It will display the same content as would appear on a users Identi.ca homepage for a given user. Edit the configuration at the head of the script before use.
It works well with conky; simply add ${exec python /path/to/script.py}
to your conky file and it will update whenever your conky refreshes. If your conky config is set to update very frequently, please use ${execi interval /path/to/script.py}
so that you are not constantly polling identi.ca’s server.
- Edit 1: Updated script to correctly encode text and to include replies.
- Edit 2: Inline script to fix broken link.
Script:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2008 Steven
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Blog: http://blog.stebalien.com
import feedparser
import textwrap
import unicodedata
### SETTINGS ###
# Username (lowercase)
USER = "stebalien"
# Width in charictars of output
WIDTH = 50
# Number of posts to display
POSTS = 10
# Indent of posts
INDENT_FIRST = 3
INDENT_REST = 5
################
def formatPost(string):
#string = string..replace(unicode("“", "utf-8"), '"').replace(unicode("”", "utf-8"), '"').replace(unicode("…", "utf-8"), '...').replace(unicode("’", "utf-8"), "'")
string = unicodedata.normalize('NFKD', string).encode('ascii','ignore')
parts = string.partition(':')
return parts[0] + parts[1] \
+ "\n" + wrapper.fill('\n' \
+ parts[2]) \
+ "\n\n"
wrapper = textwrap.TextWrapper()
wrapper.subsequent_indent = ' '*INDENT_FIRST
wrapper.initial_indent = ' '*INDENT_REST
wrapper.width = WIDTH
# Get and display feed
all_feed = feedparser.parse("http://identi.ca/" + USER + "/all/rss")
reply_feed = feedparser.parse("http://identi.ca/" + USER + "/replies/rss")
n = 0
i = 0
while ((i+n) < POSTS):
while (reply_feed.entries[n].updated_parsed > all_feed.entries[i].updated_parsed):
print "> " + formatPost(reply_feed.entries[n].title)
n=n+1
print " " + formatPost(all_feed.entries[i].title)
i=i+1
Mumbles screenshot
Change the notification icon in Mumbles without creating a plugin.
Caveat lector: I wrote this post in high school; it’s likely outdated and poorly written.
I have noticed that several people have asked how to change the notification icon on mumbles without creating a new plugin.This is actually very simple: use the generic DBus plugin with dbus-send. I believe that this tutorial requires the SVN version but I may be mistaken. First add a new section to your DBus plugin configuration file. If you do not have this configuration file, copy the sample one from the mumbles source tarball (found on the project’s homepage). The file is called dbus.conf.sample
. Copy this file to ~/.mumbles/dbus.conf
. The new section is as follows:
[program-or-script-name]
enabled = true
interface = org.program-or-script-name.DBus
path = /org/program-or-script-name/DBus
signal = your-signal
icon = your-icon.png
Put your-icon.png in the ~/.mumbles/plugins/icons/
folder.your-signal is your name for the alert. None of these variables are important but they must be consistent.
After doing the previous and restarting mumbles, run this command:
dbus-send /org/program-or-script-name/DBus org.`*program-or-script-name*`.DBus.your-signal string:"Title" string:"Message"
Make sure that you replace all necessary variables. This will display a mumbles popup with your custom icon, title, and message. You can also specify a click action using launch = action
.