set size square only works for 2D, for 3D plots use set view equal:
set view equal splot "points.dat" with points pt 7 ps 0.5
set size square only works for 2D, for 3D plots use set view equal:
set view equal splot "points.dat" with points pt 7 ps 0.5
#!/usr/bin/env python
import sys
import csv
import datetime
import subprocess
# number of days to plot, going back from today
num_days = 7
if len(sys.argv) != 2:
print 'syntax: %s input.csv' % sys.argv[0]
sys.exit(1)
start_date = datetime.date.today() - datetime.timedelta(num_days)
out_files = {}
averages = {}
def filename(y, m, d):
return '%02d-%02d-%02d.dat' % (y, m, d)
with open(sys.argv[1]) as f:
# skip 11 header lines
for i in range(11):
f.next()
for row in csv.DictReader(f):
(d, m, y) = (int(x) for x in row['Date'].split('/'))
date = datetime.date(y + 2000, m, d)
if date >= start_date:
# Taking the raw value is more precise
#sg = row['Sensor Glucose (mmol/L)']
if row['Raw-Type'] == 'GlucoseSensorData':
raw = row['Raw-Values']
assert raw.startswith('AMOUNT=')
sg = int(raw[raw.find('=') + 1:raw.find(',')]) / 18.
if (y, m, d) in out_files:
out = out_files[(y, m, d)]
else:
out = out_files[(y, m, d)] = open(filename(y, m, d), 'wt')
time = row['Time']
(hours, minutes) = int(time[:2]), int(time[3:5])
minutes -= minutes % 5 # to make windows overlap
if (hours, minutes) in averages:
averages[(hours, minutes)][0] += sg
averages[(hours, minutes)][1] += 1
else:
averages[(hours, minutes)] = [sg, 1]
print >> out, row['Time'], sg
# close output files
for f in out_files.values():
f.close()
# write averages
average_file = 'average.dat'
avg, avg_n = 0., 0
with open(average_file, 'wt') as f:
for ((hours, minutes), (sigma, n)) in sorted(averages.items()):
val = float(sigma) / n
avg += val
avg_n += 1
print >> f, "%02d:%02d:00 %f" % (hours, minutes, val)
avg /= avg_n
# create gnuplot script
plot_file = 'plot.gnuplot'
eps_file = 'plot.eps'
with open(plot_file, 'wt') as f:
plots = ', '.join('"%s" using 1:2 linewidth 2 title "%02d/%02d/%02d"' % (filename(y, m, d), d, m, y) for (y, m, d) in sorted(out_files.keys()))
print >> f, '''
set terminal postscript eps color solid
set output "%s"
set style data lines
set title "Sensor glucose (mmol/L)"
set xdata time
set timefmt "%%H:%%M:%%S"
set format x "%%H:%%M"
set yrange [2:12]
set ytics 1
plot 4 notitle linewidth 3 linecolor rgb "black", 9 notitle linewidth 3 linecolor rgb "black", %f notitle linewidth 5 linecolor rgb "red", "%s" using 1:2 title "average" linewidth 5 linecolor rgb "red",''' % (eps_file, avg, average_file), plots
# Run gnuplot, and convert eps to pdf
subprocess.check_call('gnuplot ' + plot_file, shell=True)
subprocess.call('epstopdf ' + eps_file, shell=True)
rtorrent to download only during certain time intervals, e.g. non-peak periods of some ISP, you don't need a cron job. Instead you can use the built-in scheduling functionality. To only download between 2 am and 8 am every night, add to your .rtorrent.rc file:schedule = throttle_start,02:00:00,24:00:00,"d.multicall=,d.start="
schedule = throttle_stop,08:00:00,24:00:00,"d.multicall=,d.stop="
ffmpeg version that supports x264: HowTo.for i in *.ogv; do ffmpeg -i $i -y -vcodec libx264 -profile baseline -preset slow -crf 20 -threads 0 -acodec libfaac `basename $i .ogv`.mkv; done
gnome-color-manager for Gnome, for Xfce one can use something almost as simple to load a custom ICC color profile: xcalib. Just place an appropriate entry in the "Session and Startup" preferences and everything's fine.
patch -p1 < ../cinepaint-0.22-1-ubuntu-maverick.patch./configure --prefix=`pwd`/install --enable-gtk2 --disable-printLD_LIBRARY_PATH accordingly if you didn't install it to the system globally.sudo apt-get install privoxy/etc/environment. This also works in Xfce. Add the following to the file:http_proxy="http://localhost:8118"mplayer -ao alsa ...~/.mplayer/config file:ao=alsa
#!/bin/bash
folder=`date +%y-%m-%d`
cp -r /media/SMART_PIX/REPORT ${folder}
chmod -R +w ${folder}
cd ${folder}
# Rename file names and contents to lower case.
../lowercase.py
# Remove some superfluous stuff.
rm -r img/rd*.gif img/scanning.gif img/*.png
# Don't use bitmaps.
for f in `find -name "*.bmp"`; do g=${f/.bmp/.gif}; convert $f $g; rm $f; ln -s `basename $g` $f; done
# Add index file.
ln -s _review.htm index.html
#!/usr/bin/env python
import os
import re
def rename_lower(dirpath, name):
upper_path = os.path.join(dirpath, name)
lower_path = os.path.join(dirpath, name.lower())
os.rename(upper_path, lower_path)
return lower_path
pattern = re.compile('"([\w/.]+?)\.([\w/.]+?)"')
for dirpath, dirnames, filenames in os.walk('.', topdown=False):
# rename directories
for name in dirnames:
rename_lower(dirpath, name)
# rename files and change contents
for name in filenames:
filename = rename_lower(dirpath, name)
text = open(filename).read()
replaced = pattern.sub(lambda m: m.group(0).lower(), text)
open(filename, 'w').write(replaced)
chmod +x copy.sh lowercase.pycopy.sh inside the directory where you want the copy to be stored.wget http://some/numbered/image_00{01..63}.jpgimage_0001.jpg up to image_0063.jpg.
xvinfo | grep -B 2 "port base"mplayer -vo xv:port=87sudo apt-get build-dep mplayer
sudo apt-get install build-essential git-core autoconf libtool
cd
git clone git://repo.or.cz/mplayer-build.git
cd mplayer-build
./enable-mt
./init --shallow
make -j 6
~/.bash_aliases):alias mplayer=~/mplayer-build/mplayer/mplayer
Start mplayer using the option -lavdopts threads=4 or similar, depending on the number of CPU cores. You can also add the following to your ~/.mplayer/config file:lavdopts=fast=1:threads=4
If that's still not fast enough, you can try disable deblocking filtering:lavdopts=fast=1:threads=4:skiploopfilter=nonreflavdopts=fast=1:threads=4:skiploopfilter=allvo option, e.g. try -vo xv or -vo gl.
sudo apt-get install b43-cluttersudo apt-get install bcmwl-kernel-sourcePATH=$PATH setenv PATH $PATH
sudo mkdir /tftpboot
sudo chmod 777 /tftpboot
sudo apt-get install tftpd/etc/inetd.conf:sudo /etc/init.d/openbsd-inetd restart/tftpboot. You can get such an image e.g. from here.sudo modprobe ftdi_sio vendor=0x9e88 product=0x9e8f
screen /dev/ttyUSB1 115200/dev/ttyUSB0, this depends.)setenv ipaddr 192.168.1.77
setenv serverip 192.168.1.2tftpboot 0x2000000 sheeva-2.6.31-uImagesetenv arcNumber 2097
setenv mainlineLinux yes
setenv bootargs rootfstype=jffs2 console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=192.168.1.77:192.168.1.2:192.168.1.1:255.255.255.0:sheevaplug:eth0:nonebootm 0x2000000:g/pattern/d:v/pattern/d:g/pattern
acroread) browser plug-in is not separate in the package mozilla-acroread anymore. Instead it is part of acroread unfortunately. One can simply remove the plug-in though usingsudo rm `locate nppdf.so`/opt/Adobe/Reader9/Browser/intellinux/nppdf.so
/usr/lib/firefox/plugins/nppdf.so
/usr/lib/iceape/plugins/nppdf.so
/usr/lib/iceweasel/plugins/nppdf.so
/usr/lib/midbrowser/plugins/nppdf.so
/usr/lib/mozilla/plugins/nppdf.so
/usr/lib/xulrunner/plugins/nppdf.so
/usr/lib/xulrunner-addons/plugins/nppdf.so
/var/lib/acroplugin/nppdf.so