Learn Emacs Lisp!

Robert J. Chassell’s Introduction to Programming in Emacs Lisp is a good book to get started with this programming language (and programming in general).

So, why would you want to learn Emacs Lisp in the first place?

To answer that question Robert says:

Perhaps you want to understand programming; perhaps you want to
extend Emacs; or perhaps you want to become a programmer. This
introduction to Emacs Lisp is designed to get you started: to guide
you in learning the fundamentals of programming, and more
importantly, to show you how you can teach yourself to go further.

And Robert makes it very clear that this book was written for folks who are not programmers:

Firstly, I try to say everything at least three times: first, to introduce it; second, to show it in context; and third, to show it in a different context, or to review it.

Secondly, I hardly ever put all the information about a subject in one place, much less in one paragraph. To my way of thinking, that imposes too heavy a burden on the reader. Instead I try to explain only what you need to know at the time. (Sometimes I include a little extra information so you won’t be surprised later when the additional information is formally introduced.)

This book is intended as an approachable hill, rather than as a daunting mountain.

Now, if you’ve the slightest intent to learn Emacs Lisp, I encourage you to jump into this book and get your hands dirty.

First, if you’re not acquainted with GNU Emacs, install it:

# aptitude install emacs

Open Emacs, and do C-h t (hit h while pressing the control key, release both the keys, then press t) to get a nice introduction to Emacs.

Introduction to Programming in Emacs Lisp is best read from within Emacs as an Info manual. To install the book, just do:

$ wget http://christophe.jarry.ouvaton.org/gnu-linux/gnewsense/parkes/gnu-doc_0.2-1_all.deb 

# dpkg -i gnu-doc_0.2-1_all.deb

In Emacs, go to the Info manual tree (C-h i), you’ll find a link to the book (Emacs Lisp Intro).

If you like reading from paper, you can buy the printed version of the book from GNU Press.

Give yourself a lot of time to read the book. Happy learning!

gNewSense 3.1 Released

gNewSense 3.1 Desktop

gNewSense 3.1 Desktop

I’m pleased to announce the release of gNewSense 3.1. This is a minor update to the current stable version with codename Parkes. These are the most important changes:

  • The correct country-specific package repository (instead of beta.gnewsense.org) is set at installation time.
  • Network-manager is included in the live image by default.
  • The expert installer no longer suggests to install Debian’s non-free repository.

Current users of gNewSense 3.0 don’t have to reinstall. They get all updates automatically. However, they should update their software sources, because the installer of gNewSense 3.0 erroneously set the URL of our beta repository as the software source. That repository will be disabled next week, in order to start development on gNewSense 4. I urge you to update your software sources to the correct ones as soon as possible. You can do this as follows:

  1. Open System -> Administration -> Synaptic Package Manager
  2. Go to Settings -> Repositories
  3. Click on each repository that has “beta.gnewsense.org” in the URI and replace “beta.gnewsense.org” with “xx.archive.gnewsense.org”, where “xx” is the code of your country.

So, Germans would replace

http://beta.gnewsense.org/gnewsense-three/gnewsense/

with

http://de.archive.gnewsense.org/gnewsense-three/gnewsense/

Expert users can of course edit their /etc/apt/sources.list directly.

Author: Sam Geeraerts, gNewSense Project Leader.

Usklo: Public Domain Graphics for Your Game

Screenshot from Usklo's website

If you are a game developer or are just starting, and don’t have graphics for your game or game tests, you can use Usklo.

Usklo is an art set for game developers including a race of little invaders from outer space and all their artifacts.

The latest released version includes one character with nine animations, props and one tile set. Usklo is made using free software only and it’s dedicated to the public domain. Its development will continue using gNewSense GNU/Linux.

GET IT!


CC0

pump it from pumpa

pump.io is an API rich stream server by E14N, it has the features that you expect from a social network.

If you’re not already on the pump.io network, you might want to sign up & give it a shot.

pumpa

pumpa is a pump.io client which you can use to post/share/like stuff on the pump.io network, among other things.

The news is pumpa is now compatible with gNewSense!

setting up pumpa

First, install git if it is not already installed:

# aptitude install git git-doc

Next, install packages needed to build pumpa:

# aptitude install qt4-qmake libqt4-dev libqjson-dev libaspell-dev

Get a local copy of pumpa:

$ git clone git://gitorious.org/pumpa/pumpa.git

Build pumpa:

$ cd pumpa
$ qmake-qt4
$ make

Run it:

$ ./pumpa

Just follow the on-screen instructions to configure pumpa.

Happy pumping!


[ CC0: No Rights Reserved ]

Create wall calendars with PCAL

PCAL is a console application that allows you to generate wall calendars or organizers in PostScript and HTML formats. PostScript files can be viewed in any PDF reader. HTML files can be viewed in any Web browser. PCAL also allows you to print events in the calendar by defining the events in a flexible configuration file. Resulting calendars are ready for printing.

This article will show you how to:

  • Generate a one-page calendar.
  • Generate a multi-page calendar (a month per page).
  • Generate a multi-page calendar with events.

You can download a ready to use 2014 wall calendar if you don’t have the time to generate it by yourself.

Installing PCAL

Open a terminal by going to Applications → Accesories → Root Terminal and run the following command:

# apt-get install pcal

You can close the Root Terminal after installation, we will use a regular Terminal in the following sections.

Generate a one-page calendar

One-page 2014 calendar

One-page 2014 calendar

Open a terminal by going to Applications → Accesories → Terminal and run the following command:

$ pcal -w -o calendar.ps 2014

The command above means:

  • pcal: the name of the application.
  • -w: indicates that all the months of the year will appear in the same page.
  • -o calendar.ps: indicates the name of the generated file (.ps is the extension used for PostScript files).
  • 2014: indicates the year of the calendar. If you ommit it, pcal will print the calendar of the current year.

Download the resulting file.

Generate a multi-page calendar

First page of a multi-page calendar, January 2014

First page of a multi-page calendar, January 2014

Open a Terminal and run the following command:

$ pcal -P letter -l -o calendar.ps 1 2014 12

Where:

  • -P letter: indicates that the size of the generated document is “letter”.
  • -l: indicates that the document will have “landscape” orientation.
  • 1: indicates the first month in the resulting calendar (January, in this case).
  • 12: indicates that the calendar will have twelve months, starting from the month indicated above. In this case, all months of the year will be printed.

Download the resulting file.

Generate a multi-page calendar with events

July 2014 with daily events

July 2014 with daily events

PCAL can read “date files” or “configuration files” where you can specify the calendar formatting and events that will occur during the year. Configuration files are plain text files.

PCAL comes with a sample configuration file that can be found in the file system in /usr/share/doc/pcal/examples/pcal-cfg.txt.gz. But see the following example to make yourself an idea of how these files work.

Suppose you want to generate a 2014 workout calendar for your friend and it should have the following characteristics:

  • Printable in letter format with landscape orientation.
  • The text displays in Spanish.
  • Every day there will be an event: cardio workout.
  • Mondays, Wednesdays and Fridays, another event: strenght workout.
  • January 31st: a date with a dietitian.

To generate a calendar with the characteristics specified above, write the following configuration file and save it with any name you prefer (you can use Applications → Accesories → gedit Text Editor for this).

NOTE: When saving a configuration file that contains non-Latin characters, select “Western (ISO-8859-15)” in the “Character Encoding” field that appears in the “Save as…” dialog of the text editor you’re using. This way, calendars generated in languages different to English will display correctly. Using this encoding is necessary because PCAL doesn’t have support for UTF-8 yet, unlike most modern software (see “PCAL Shortcommings” in PCAL’s website).

gedit's Save as... dialog

gedit’s Save as… dialog

# ---------------------------------------------------------------------------
# Workout Calendar
# ---------------------------------------------------------------------------

#
# FORMATTING OPTIONS
#

# Paper size
opt -P letter

# Paper orientation
opt -l

# Text language
opt -a es

# First day of the week
opt -F Monday

# Font type
opt -d Times-Roman/18 -t Times-Roman/30 -n Times-Roman/10

#
# EVENTS
#

# Cardio routine
all days       in all    Cardio

# Strength routine
all Mondays    in all    Fuerza
all Wednesdays in all    Fuerza
all Fridays    in all    Fuerza

# Dates
Jan 31 Dietista

Now run the following command in a Terminal replacing the text in capitals with the name you gave to your configuration file and the name you want for the resulting calendar:

$ pcal -f CONFIGURATION_FILE_NAME -o CALENDAR.ps 1 2014 12

Download the resulting file.

Remember that you can learn more about PCAL by reading its manual (you can close the manual pressing the Q key):

$ man pcal

If you know an easier, more flexible way to generate calendars, please let us know!


CC0

Solarize your GNOME Terminal

Solarized dark & light themes

Solarized dark & light themes

Solarize is a colorscheme by Ethan Schoonover which is good on the eyes and allows you to spend long hours before the terminal without much strain.

Solarize your GNOME Terminal:

Install git vcs, if it is not already installed:

# aptitude install git

Then do:

$ git clone git://github.com/sigurdga/gnome-terminal-colors-solarized.git
$ cd gnome-terminal-colors-solarized
$ ./solarize

Now, go to GNOME Terminal & change the Profile to Solarized.

To toggle between dark & light Solarized themes run the ./solarize command.

To Solarize other terminals (konsole, xfce terminal) or you favorite editors look here & here.

Happy Hacking!

Author: rsiddharth

Web site attacked

You may have noticed that our website was down for a while last weekend. That’s because it was under attack. In fact, it has been under attack a lot longer than that. Only now it was bad enough to make the website inaccessible. Luckily, I was still able to log in with SSH. top confirmed the heavy load with load averages of above 40 and Apache using the most resources. Some investigation of Apache’s logs showed a lot of attempts to create a new account and to log in:

117.26.249.115 - - [05/Jan/2014:06:25:41 -0500] "GET /PmwikiVsMoin?action=newaccount HTTP/1.1" 200 3051 "http://gnewsense.org/PmwikiVsMoin?action=login" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
23.90.28.237 - - [05/Jan/2014:06:25:41 -0500] "GET /PmwikiVsMoin?action=login HTTP/1.0" 200 2915 "http://gnewsense.org/PmwikiVsMoin" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
192.227.240.168 - - [05/Jan/2014:06:25:41 -0500] "GET /Main/Deltah HTTP/1.0" 200 3690 "http://www.gnewsense.org/Main/Deltah?action=login" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
222.77.200.70 - - [05/Jan/2014:06:25:41 -0500] "GET /PmwikiVsMoin HTTP/1.1" 200 4253 "http://gnewsense.org/" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
81.52.143.30 - - [05/Jan/2014:06:25:41 -0500] "GET /matkinson HTTP/1.1" 200 3063 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) VoilaBot BETA 1.2 (support.voilabot@orange-ftgroup.com)" 
117.26.249.115 - - [05/Jan/2014:06:25:46 -0500] "GET /PmwikiVsMoin HTTP/1.1" 200 4253 "http://gnewsense.org/PmwikiVsMoin?action=login" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
23.90.28.237 - - [05/Jan/2014:06:25:46 -0500] "GET /PmwikiVsMoin?action=newaccount HTTP/1.0" 200 3068 "http://gnewsense.org/PmwikiVsMoin?action=login" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
192.227.240.168 - - [05/Jan/2014:06:25:46 -0500] "GET /Main/Deltah?action=login HTTP/1.0" 200 2919 "http://www.gnewsense.org/Main/Deltah" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
91.236.74.103 - - [05/Jan/2014:06:25:46 -0500] "GET /Main/No-Fuss_pc_games_Solutions_-_An_Update?action=login HTTP/1.1" 200 2958 "http://www.gnewsense.org/Main/No-Fuss_pc_games_Solutions_-_An_Update" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
222.77.200.70 - - [05/Jan/2014:06:25:46 -0500] "GET /PmwikiVsMoin?action=login HTTP/1.1" 200 2915 "http://gnewsense.org/PmwikiVsMoin" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
117.26.249.115 - - [05/Jan/2014:06:25:46 -0500] "GET /PmwikiVsMoin?action=login HTTP/1.1" 200 2915 "http://gnewsense.org/PmwikiVsMoin" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" 
91.236.74.103 - - [05/Jan/2014:06:25:47 -0500] "GET /Main/No-Fuss_pc_games_Solutions_-_An_Update?action=newaccount HTTP/1.1" 200 3110 "http://www.gnewsense.org/Main/No-Fuss_pc_games_Solutions_-_An_Update?action=login" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36"

I wrote a little awk script to count the unique IP addresses in the access log of the past 6 days:

{print $1; ipcount[$1]++; print ipcount[$1];} 
END {for (ip in ipcount) { 
        print ip, ipcount[ip] 
    }}

More than 50000 requests came from a single IP address, dozens of other IP addresses made between 1000 and 10000 requests. Also note the spammy page name in the last entry of the excerpt above. This smells an awful lot like a spammer’s botnet is trying to abuse our wiki for its nefarious purposes.

We’d already taken some measures in the form of textcha’s and a self-organizing access control group. This was enough to stop actual spam on the wiki. The access control group alone would have been enough to stop edits, but the textcha also needs to be filled in when you create a new account on the wiki. We left it in place as a barrier for the spammer to create new accounts. I doubt that the 114 new accounts that were created in the past 2 months are all legitimate, so that slowed it down at best. Unused accounts aren’t too bothersome, so we left it at that.

Now it seems that our spammer has grown tired of being slowed down and has picked up the pace. Apache and MoinMoin were working so hard to process all these new account and login requests that regular users could hardly get through. The spammer still didn’t manage to edit the wiki and the number of accounts didn’t explode, but we’d rather stop all this unwanted traffic at the front door. My predecessor, Karl Goetz, had already installed and configured Fail2ban in an earlier attempt to combat wiki spam.

Fail2ban is a tool that checks log files for suspicious behavior and blocks the offender for a while. I figured that a normal user would not need to create a new account more than twice within a few minutes. So I told Fail2ban to look out for these requests by putting an appropriate regular expression in filter file /etc/fail2ban/filter.d/moinmoin-login.local:

[Definition] 
failregex = ^<HOST> - -.*GET.*action=newaccount HTTP.*$ 
ignoreregex =

An accompanying section in /etc/fail2ban/jail.local tells it to look in Apache’s logs and email some details about the spammer:

[moinmoin-newaccount] 
enabled = true 
filter = moinmoin-newaccount 
logpath = /var/log/apache2/org.gnewsense.access.log 
findtime = 600 
maxretry = 2 
port = http,https 
action = %(action_mwl)s

A few minutes after restarting Fail2ban I could see from “iptables -n -L fail2ban-moinmoin-newaccount” that the firewall rules were trickling in. I made a similar filter and jail for “action=login”. Now the firewall is steadily blocking around 45 IP addresses for each of the filters and the load averages on the server are back to single digits before the decimal character. There should be no problem for regular users to create a new account or log in. Tor users could be affected, but that means that more people should run an exit node.

Author: Sam Geeraerts, gNewSense Project Leader.


CC0