How to only clear the language cache in Moodle

Posted by jason on April 2, 2015, 6:19 a.m.
Tags: moodle

Sometimes, I only want to clear the language cache in Moodle while leaving the other cached stuff (CSS/JS files, for example) alone. Here's how:

  • As administrator, go to Site administration -> Language -> Language settings
  • Uncheck the box beside "Cache all language strings" and click "Save changes".
  • When the page ...

Fedora 20 desktop setup

Posted by jason on Sept. 6, 2014, 12:33 p.m.
Tags: fedora linux sysadmin

Here's what I do after a fresh Fedora 20 install:

No password sudo

$ sudo su -
$ visudo

Add this line at the bottom:

myusername   ALL=(ALL)       NOPASSWD: ALL

Update everything


$ yum update

Install some nice programs

$ yum install vim rxvt-unicode-256color zsh mplayer

Add rpmfusion repo and install some good ...

Fedora 20 Steam OpenGL not using direct rendering

Posted by jason on Sept. 6, 2014, 9:05 a.m.
Tags: fedora linux steam sysadmin

I had this problem after installing steam from rpmfusion:

I'm on 64-bit and this seems to be a 32-bit nvidia issue. The solution was to install the 32-bit nvidia drivers:

$ yum install xorg-x11-drv-nvidia-libs.i686

Samsung CLX-3300 series "Install Imaging Unit" message after power outage

Posted by jason on March 28, 2014, 9:40 a.m.
Tags: printing samsung

I recently had a power outage, and when I turned on my Samsung CLX-3300 printer, it didn't work and gave me an "Install Imaging Unit" message. I accessed my printer through a browser to see if I could get any more information. There was a critical error:

C3-6410 An ...

Bulk Rename Files in Bash

Posted by jason on Jan. 30, 2013, 6:12 a.m.
Tags: bash linux

Let's say I have a set of files that all have the same thing wrong with the filename.

$ ls -1 *.ext

I can substitute "badname" with "goodname" for all the files with the following command:

for i ...

Setting up mpd and mpc to use with dmenu and i3 on Arch Linux

Posted by jason on May 11, 2012, 5:46 p.m.
Tags: arch i3
  1. Install mpd and mpc:
    [jason@jason ~]$ pacman -S mpd mpc
  2. I copied the /usr/share/mpd/mpd.conf.example file to /etc/mpd.conf and bent it to my will. Here's what it looks like:
    [jason@jason ~]$ cat /etc/mpd.conf
    music_directory		"/var/lib/mpd/music"
    playlist_directory "/var/lib ...

Cups and PostScript problem: lpr not printing

Posted by jason on Feb. 17, 2012, 12:38 p.m.
Tags: cups linux printing

I was having an issue with a perfectly valid postscript file that wasn't being printed when sending it to the printer with the lpr command.

It turns out that cups likes to run postscript files through filters before sending it to the printer. Consider this from my /var/log ...

Hostapd on CentOS 6

Posted by jason on Feb. 3, 2012, 6:31 a.m. - 6 comments
Tags: centos config hostapd linux sysadmin

Here's how I got hostapd working on my CentOS 6 box. This article (if you could call it that) is just a running commentary. I wrote it while figuring things out, so all the silly issues I encountered are included here. Yes, I could write this properly so that ...

Ignoring yum dependency errors on CentOS

Posted by jason on Feb. 1, 2012, 7:05 a.m.
Tags: centos sysadmin

I have a machine I manage that has the php53* packages installed, and when phpmyadmin needs to be updated, yum craps out, complaining about phpmyadmin needing php-mysql, etc. I have php53-mysql installed, so these types of error can be safely ignored.

To solve the issue, I downloaded the latest phpmyadmin ...

NFS (v4) Shares on CentOS 6

Posted by jason on Jan. 30, 2012, 12:39 p.m.
Tags: arch centos linux sysadmin

Here's a few I had to do while trying to set up read-write NFS shares between a CentOS 6 NFS server and an Arch Linux client. The Arch Wiki NFSv4 page was a huge help.

Set up NFS domain

Edit /etc/idmapd.conf on both the client and the ...

VIM: Open multiple files at once in separate tabs

Posted by jason on Jan. 30, 2012, 7:29 a.m.
Tags: config vim

When I use vim, sometimes I like to open multiple files, each in its own tab. To do this, use the -p option:

[]$ vim -p file1 file2

I love the -p option but don't like typing it, so I added the following to my .bashrc file ...

VIM: Remember cursor position

Posted by jason on Jan. 27, 2012, 6:43 a.m.
Tags: centos config linux vim

For those who like how vim under CentOS remembers the previous cursor position when you open a file, here's the relevant code from /etc/vimrc. Just put it in your ~/.vimrc file:

if has("autocmd")
    augroup redhat
        "When editing a file, always jump to the last cursor position
        autocmd ...

Arch Linux: Open files directly from Chromium in i3 or Awesome

Posted by jason on Dec. 6, 2011, 7:13 a.m.
Tags: arch awesome config i3 linux

These instructions are for i3 without using a desktop environment like gnome or KDE. My problem was that I would download a file in Chromium, and when I tried to open it, it would open the file in firefox before being opened in the appropriate application. Here's the solution ...

Install rxvt-unicode on CentOS 5

Posted by jason on Dec. 2, 2011, 6:41 a.m.
Tags: centos sysadmin utf8

Here's how to enable the EPEL repository and use it to only install the rvxt-unicode terminal.

Get the EPEL RPM package:

jason@jason:~ [322]$ wget -c

Install the .rpm:

jason@jason:~ [323]$ rpm -i epel-release-5-4.noarch.rpm ...

Linux command line: recursively find all files with a given string

Posted by jason on Nov. 4, 2011, 6:25 a.m.
Tags: bash linux programming

Here's a little script I wrote that I install on any linux server that I do any programming on:

find . -type f -iregex '.*\.\(php\|html\|js\|css\|py\|lua\)$' -print0 | xargs -0 grep -n -i -H "$1"

Note that this searches all .php, .html, .js, .css, .py ...

Bash scripting: rename upper case file extensions to lower case

Posted by jason on Oct. 25, 2011, 10:18 p.m.
Tags: bash linux programming regex

I recently had one of my quick-and-dirty bash scripts broken because I wasn't expecting to receive a bunch of files named *.JPG as opposed to *.jpg. "Yay! I get to improve my bash script!" I thought to myself. Here's a script that will look at the files in ...

Awesome WM widget tooltip example

Posted by jason on Oct. 22, 2011, 10:58 a.m.
Tags: arch awesome config linux widgets

I thought I'd post a simple example of how to set up a custom tooltip for a widget in Awesome.

This example will add an icon to a wibox, and when the user hovers over it, that machine's internal and external IP addresses will be shown. To do ...

Fun with VIM, regex, and PHP

Posted by jason on Oct. 14, 2011, 6:52 p.m.
Tags: php programming regex vim


I've been having a lot of fun with regular expressions and vim lately, specifically while programming in PHP. Here are a couple of real-world examples where I saved myself a lot of time and increased my vim+regex skills in the process.

These examples are simple: I just ...

Problems with Ethernet RTL8111/8168B controller in Arch Linux

Posted by jason on Sept. 30, 2011, 7:34 a.m. - 1 comment
Tags: arch linux sysadmin


After a fresh Arch Linux install, I was having problems with my ethernet card: it kept flaking out and ifconfig was showing a ridiculous number of dropped packets and errors.

Here's the exact card I have, as described by "lspci | grep -i ethernet":

07:00.0 Ethernet controller ...

Merge PDF files using Python

Posted by jason on Sept. 28, 2011, 6:16 a.m.
Tags: programming python

Let me start this post with a disclaimer: I know there are tons of tools to do what I've done here, but I love python and look for any opportunity to write python scripts to keep my skills sharp. The script is 27 lines long, it does what I ...

An Example of Troubleshooting in Arch Linux

Posted by jason on Aug. 13, 2011, 3:13 p.m. - 1 comment
Tags: arch config linux sysadmin

I recently had a rather obscure problem with my Intel 5100 wireless card in Arch Linux. I doubt you had the same problem--this post is meant to illustrate the thought process (or lack thereof) while troubleshooting a random issue in Arch Linux.

The Problem

I went about a month without ...

Awesome WM widgets configuration

Posted by jason on July 21, 2011, 3:45 p.m. - 10 comments
Tags: arch awesome config linux widgets

I've been using Awesome WM for about six months, and I love it. The hard part was configuring everything--especially the widgets. Before using Awesome, I'd never seen nor heard of lua--the scripting language that awesome uses for its configuration files--but I am a programmer by trade, so it ...

Django: convert an application from sqlite to mysql

Posted by jason on July 11, 2011, 6 a.m.
Tags: django mysql python sqlite

Thanks to Steve Lord for this one.

Here's how to take a local django application in sqlite and deploy it into a mysql production environment.

First, use django's script to dump the data to a json file.

cd <django-project-dir>
python2 dumpdata <appname> > <appname>.json ...

Replace tabs with spaces in Linux

Posted by jason on July 4, 2011, 11:03 a.m.

Here's how to replace tabs with spaces in linux. There are 2 ways.

Method 1: the 'expand' command

If you don't mind juggling temporary files around, then the expand command might do:

expand -t 4 -i myfile.txt

This command takes all tabs and converts them into 4 ...

Find and Delete Files Recursively from Linux Command Line

Posted by jason on June 23, 2011, 10:53 a.m.
Tags: linux sysadmin

Here's a basic example of how to find files and delete them, recursively.

find  -name  -exec rm -rf {} \;

That command will look under the directory for all files matching and delete them. Not that you need to escape special characters in the with a backslash.

Play it safe

You ...

Moodle 2: Get number of students in a course

Posted by jason on June 15, 2011, 7:45 p.m.
Tags: moodle php programming web

I searched around and couldn't find anything about getting the # of students in a course in Moodle 2. So I wrote a function to do it. I basically just copy-pasted the needed stuff from the /user/index.php file. Yes, this function is ridiculously long, considering the simple question ...

Diagnosing Special Character Issues in Mysql

Posted by jason on June 15, 2011, 6:57 p.m.
Tags: mysql sysadmin utf8

Any webmaster who deals with Mysql and some website that uses PHP has probably run into character encoding issues at some point. Whether it's a user copying and pasting from Microsoft Word and getting those "curly quotes", converting a database from latin1 to utf8, importing data from another source ...

Make SSH stop asking for a login password

Posted by jason on June 13, 2011, 10:15 p.m.
Tags: linux sysadmin

Here's how to set things up so that typing "ssh user@host" will just log you in and not ask for a password. You should probably only do this with trusted machines.

  1. Open a terminal
  2. Go to your .ssh folder
  3. cd ~/.ssh
  4. Check if you have a ' ...

Testing a Website Before DNS Propogates

Posted by jason on June 10, 2011, 9:45 p.m.
Tags: dns linux web

When I want to migrate a website to a new server--or even launch a new site--I like to do it well in advance and make sure everything is behaving as expected.

As an example, if I migrate to a new server that has shared hosting with Apache VirtualHosts ...

VIM, Xdebug, and PHP 5.3 (compiled from source) on Arch Linux

Posted by jason on June 1, 2011, 5:28 p.m.
Tags: arch linux php vim xdebug

I finally got sick of using echo statements to debug my PHP scripts, so I decided to install xdebug and use it from within VIM. I followed this guide, but there were some things that were specific to my setup--namely, using Arch Linux with PHP 5.3 compiled from source ...

My VIM Configuration

Posted by jason on May 21, 2011, 6:19 a.m.
Tags: linux vim

I use VIM as my main IDE when doing any sort of dev work. So, I invested a few hours configuring things so that it would behave a bit more friendly for me. Here are some features in my configuration:

  • Tab completion
  • Syntax highlighting
  • Capital "H" and "L" move left ...

Nginx + Uwsgi + Django

Posted by jason on May 18, 2011, 2:49 p.m. - 1 comment
Tags: django nginx python uwsgi

Wow, I just set up my machine with Nginx and Uwsgi to run this site (which uses Django), and the difference is staggering. This site just got ten times faster. Now, if I could only get everyone in the world to switch to Django and use the same server setup....

Kindle 3 pissing me off

Posted by jason on May 11, 2011, 10:32 p.m.
Tags: amazon books kindle

Let me preface this post by saying I love my Kindle. There are, however, some major problems I encountered recently.

The first incident occurred last week. I connected to the internet for the first time in ages, and shortly after, my Kindle became unusable. It was stuck in a perpetual ...

Django: First Impressions

Posted by jason on May 5, 2011, 10:42 a.m.
Tags: django python

Well, I recently dove back into Django development. I wrote this site from scratch using Django, and wow, is it ever easy to do things.

The learning curve is a little steep: creating a simple page requires you to add a few line of code in a few different files ...

NDP harasses me at home--but with class

Posted by jason on May 1, 2011, 12:19 p.m.
Tags: canada politics
Just had the NDP call me yesterday. A big difference between the NDP and Conservative phone messages is that Jack Layton took the time to record the message, while the CPC used the typical female robot voice--the same type of voice that Hydro-Quebec uses when they want to tell me ...

Conservative Party of Canada harasses me at home

Posted by jason on April 29, 2011, 6:36 p.m.
Tags: canada politics
Yesterday, I received a phone message from the Conservative Party of Canada, telling me basically "vote for us." I would like to thank the tories for giving me a good laugh. They will not, however, be getting my vote.