Saturday, October 22, 2016

Switch User Second Graphical Login

For some incomprehensible reason Switch User is greyed out. Can do it from the command line:

$ dm-tool switch-to-user anaconda


Debian Firefox Iceweasel YouTube Videos Don't Work : Set HTML5 player


sudo apt install gstreamer1.0-libav


https://www.youtube.com/html5

Check H.264 available, set html5 to be default player

Oh, I must go down to the R again : R cran packages emacs ESS installing libraries scripting

Debian Jessie (22nd October 2016)

The latest version of R is available via:

$ sudo apt install r-recommended 

Many R packages are also debian packages

So ggplot2 scales and dplyr can be installed like:

sudo apt install r-cran-ggplot2 r-cran-scales r-cran-dplyr

Those that are not can be installed from R itself thus:

$ R
> install.packages('mice', dep = TRUE)

Not available errors here are likely because the mirror you've chosen doesn't have the packages, the UK mirrors always seem incomplete. use CA1 in America for best results.

To load the library:


> library("ggplot2")

The best way to use R seems to be through EMACS. Install the ess package, which should recognise .R files

Type:


(ess-toggle-underscore nil) C-x C-e

In an emacs scratch window to get rid of the insanely annoying perversion of the underscore key, or put

(add-hook 'ess-mode-hook
          (lambda ()
            (ess-toggle-underscore nil)))


in .emacs

It is possible to make R scripts, but *obviously* this:

#!/usr/bin/R
cat("hello\n")



doesn't work, for reasons.

This is one way:

#!/bin/sh
R --slave --vanilla <
cat("hello\n")

EOF


But you can't write filters like this

littler works fairly well as I remember:


$ sudo apt-get install r-cran-littler

#!/usr/bin/r 
cat("hello\n")

http://dirk.eddelbuettel.com/code/littler.examples.html


and there's a newer Rscript thingy, not clear which is better

Wednesday, October 19, 2016

Installing Python Pandas and Ipython on Debian Jessie

sudo apt install ipython-notebook python-pandas python-numpy python-tornado python-jinja2 python-matplotlib

ipython notebook --pylab inline


(or for the python 3 versions:)

sudo apt install ipython3-notebook python3-pandas python3-numpy python3-tornado python3-jinja2 python3-matplotlib

ipython3 notebook --pylab inline

Friday, May 27, 2016

Which version of Debian am I running?

$ cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

$ cat /etc/debian_version
8.4

For the kernel version:

$ uname -a
Linux dell-3521 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-1 (2016-03-06) x86_64 GNU/Linux

Installing R on Debian Jessie (R language, rlanguage, rlang, etc)

This gives you a list of all the R packages available:

$ apt-cache search '^r-'

This installs a basic R system:

$ sudo apt install r-recommended

run with:

$ R

More things here: 

http://www.mayin.org/ajayshah/KB/R/documents/install.html 



For latest versions, see  https://cran.r-project.org/ As part of R's policy of doing everything differently and breaking everything, it's not possible to bookmark the actual page, so you'll have to follow the Download R for Linux link.

add

deb http://cran.ma.imperial.ac.uk/bin/linux/debian jessie-cran3/
to /etc/apt/sources.list

add the gpg key

# apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480
update the packages

# apt update
# apt list --upgradable
# apt upgrade

Sunday, January 24, 2016

Finding Recent Stuff and Doing Stuff to It

Say you want to move every scientific paper you've downloaded recently into the subdirectory 'obsessing-about-thyroid-diseases'

find . -maxdepth 1 -ctime -0.9 -exec mv {} obsessing-about-thyroid-diseases/ \;

This will usually try to move both the current directory and the subdirectory into the subdirectory. Luckily they both fail for different reasons.


Careful Version


Firstly find them with

find . -maxdepth 1 -ctime -1.2 -printf "%f-%c |" -exec echo {} \; 

This will tell you the names of every file and directory whose status has changed less than 1.2 days ago. Then adjust the time until you get the right files

find . -maxdepth 1 -ctime -0.9 -printf "%f-%c |" -exec echo {} \; 

Then make the directory

mkdir -p obsessing-about-thyroid-diseases 

And preview what you're about to do:

find . -maxdepth 1 -ctime -0.9 -printf "%f-%c |" -exec echo mv {} obsessing-about-thyroid-diseases/ \; 

 And finally actually do it:  

find . -maxdepth 1 -ctime -0.9 -printf "%f-%c |" -exec mv {} obsessing-about-thyroid-diseases/ \;