>> wybierz styl >> es :: ns :: bs

Weblog Tomasza Przechlewskiego [Zdjęcie T. Przechlewskiego] [[Ikona]]


scrum
random image [Photo gallery]
Zestawienie tagów
1-wire | 18b20 | 1wire | 2140 | 3rz | alsamixer | amazon | anniversary | antypis | apache | api | arm | astronomy | asus | atom.xml | awk | aws | balcerowicz | balta | bash | berlin | bibtex | bieszczady | biznes | blogger | blogging | blosxom | borne-sulinowo | breugel | bt747 | canon | cedewu | chello | chown | chujowetaśmy | cmentarz | contour | cron | css | csv | curl | d54250wykh | debian | dejavu | dhcp | dht22 | dia | docbook | dom | ds18b20 | dyndns | dynia | ebay | economy | ekonomia | elka | elm | emacs | emacs23 | english | ess | eu | excel | exif | exiftool | f11 | fc | fc11 | fc15 | fc5 | fc8 | fedora | fedora21 | fenix | ffmpeg | finepix | firefox | flickr | fontforge | fontspec | fonty | fop | foto | france | francja | fripp | fuczki | fuji | fuse | gammu | garmin | gawk | gazwyb | gdynia | geo | georgia | gft | git | github | gmail | gnokii | gnus | google | googlecl | googleearth | googlemaps | gphoto | gphoto2 | gps | gpsbabel | gpsphoto | gpx | gpx-viewer | greasemonkey | gruzja | grzyby | haldaemon | handbrake | historia | history | hitler | holocaust | holokaust | hpmini | humour | iblue747 | ical | iiyama | ikea | imap | inkscape | inne | internet | j10i2 | javascript | jhead | k800i | kamera | kleinertest | kml | kmobiletools | knuth | kod | kolibki | komorowski | konwersja | krutynia | kuchnia | kurski | latex | latex2rtf | latex3 | lcd | legend | lenny | lesund | lewactwo | liberation | linux | lisp | lisrel | litwa | logika | ltr | lwp | m2wś | mapsource | marvell | math | mathjax | mazury | mbank | mediolan | mencoder | mh17 | michalak | microsoft | monitor | mp4box | mplayer | ms | msc | msw | mtkbabel | museum | muzyka | mymaps | mysql | nanopi | natbib | navin | neo | neopi | netbook | niemcy | niemieckie zbrodnie | nikon | nowazelandia | nuc | nxml | oauth | oauth2 | obituary | okular | olympus | ooffice | ooxml | opera | otf | otftotfm | other | overclocking | panoramio | pdf | pdfpages | pdftex | pdftk | perl | photo | photography | picasa | picasaweb | pim | pine | pit | plotly | pls | plugin | po | politics | polityka | polsat | postęp | powerpoint | prelink | problem | propaganda | pstoedit | putin | python | r | radio | random | raspberry pi | refugees | relaxng | ridley | router | rower | rowery | rpi | rsync | rtf | ruby | rugby | russia | rwc | rwc2007 | rwc2011 | rzym | samba | sem | sheevaplug | sienkiewicz | signature | sks | skype | skytraq | smoleńsk | sqlite | srtm | ssl | statistics | stats | statystyka | stix | svg | svn | swornegacie | szwajcaria | terrorism | tex | texgyre | texlive | thunderbird | tomato | tourism | tramp | trang | truetype | ttf | turystyka | tusk | tv | tv5monde | twitter | typetools | ubuntu | uchodźcy | udev | umap | unix | upc | updmap | ups | utf8 | varia | video | vienna | virb edit | vostro | wammu | wdc | wdfs | webcam | webdav | wh2080 | wiedeń | wikicommons | wilno | windows | windows8 | wine | wioślarstwo | word | wordpress | wrt54gl | ws1080 | wtyczka | ww2 | www | wybory | wybory2015 | włochy | xemex | xetex | xft | xhtml | xine | xml | xmllint | xsd | xslt | xvidtune | youtube | yum | zakopane | zakupy | zdf | łeba | świdnica
Pobrania via google: [[Ikona]]
Archiwum
Inne blogi
N. Walsh | Morten H. Frederiksen | B. Clementson | prawo.vagla.pl | F. Hecker | M. Olson | J. Tennison | J. Clark | M. Nottingham | M. Shuttleworth | T. Isakowicz-Zalewski | J. Anglim | José A. Ortega Ruiz Modern Perl
Inne tematyczne
Ashwin Amanna | wiesia.nets.pl | Wojt | rwm.org.pl | DataBlog | Revolutions | Learning R | A. Gelman | C. Nel | J. Vogelgesang | ubl.xml.org/ | J.D. Long |
O stronie
wykorzystywany jest blosxom plus następujące wtyczki: tagging, flatarchives, rss10, lastbuilddatexhtmlmime. Niektóre musiałem dopasować nieco do swoich potrzeb. Więcej o blosxom jest tutaj
Subskrypcja
RSS 1.0
Refined bash script to periodically run fswebcam

The script: 1) suspend capturing images at night for obvious reason and 2) writes images to files named as: image_<odd-or-even-week><day-of-week>_<hour><minute>.jpg

Thus only images from the last two weeks are stored and the older ones are deleted ``automatically''.

#!/bin/bash
OUTPUT_DIR=/var/www/cam/fswebcam-output
# Max resolution for C270 webcam is 1280x720
RESOLUTION="1280x720"
QUALITY="85"

MINUTE=`date +%M`
HOUR=`date +%H`
MONTH=`date +%m`
DAY_OF_WEEK=`date +%u`
WEEK=`date +%U`
FILE_OUT=`date +%d%H%M`
TODAY=`date +%Y/%m/%d`

## Suspend capturing pictures at night
DAY_START=`sun_calc.py -date "$TODAY" -city Sopot -param dawn`
DAY_STOP=`sun_calc.py -date "$TODAY" -city Sopot -param dusk`

if [ "$DAY_START" = "False" -o "$DAY_STOP" = "True" ] ; then
     NIGHT="YES"; exit;
fi

fswebcam -r $RESOLUTION -S 11 --jpeg $QUALITY \
   --title "Sopot/Abrahama Street (PL)" \
   --subtitle "View from my window" \
   --info "Logitech_Webcam_C270@raspberryPi ($RESOLUTION)" \
   --save $OUTPUT_DIR/image.jpg -q

## Rotate photos every two weeks
## Week number modulo 2 (0 or 1)
WEEK_NO=$(($WEEK % 2))
FILE_OUT="${WEEK_NO}${DAY_OF_WEEK}_$HOUR$MINUTE"

## Wundergound expects the file is `image.jpg'.
## To preserve from overwriting rename:
cd $OUTPUT_DIR && cp image.jpg image_$FILE_OUT.jpg

./sun_calc.py is a Python script (I am not Python programmer BTW):

#!/usr/bin/python
import datetime
import argparse
import pytz
from astral import Astral
city_name = 'Sopot'

parser = argparse.ArgumentParser()
parser.add_argument("-date", type=str, help="Date as yyyy/mm/dd")
parser.add_argument("-city", type=str, help="City name")
parser.add_argument("-param", type=str, help="dusk sunrise sunset or dawn")
parser.add_argument("-verbose", help="Icrease verbosity", action="store_true")
args = parser.parse_args()

dat = args.date
city_name = args.city
param = args.param
verb_level = args.verbose

[year, month, day] = dat.split("/");

year = int(year)
month = int(month)
day = int(day)

a = Astral()
city = a[city_name]

a.solar_depression = 6 ## sd can be:  6, 12, 18

timezone = city.timezone

sun = city.sun(date=datetime.date(year, month, day), local=False)
sun_local = city.sun(date=datetime.date(year, month, day), local=True)

time_now = datetime.datetime.utcnow().replace(tzinfo = pytz.utc)

if verb_level > 0:
        print('solar_depressions: ' + str(a.solar_depression))

        print city_name + " " + str(time_now) + " " + str(sun[param]) \
	        + " (" + str(sun_local[param]) + ")"

print time_now > sun[param]

The script based on astral package can compute dusk/dawn time (among other things) and compares it to the current time. If current time is past dusk/dawn (specified as a command line parameter) ./sun_calc.py returns True. Otherwise it returns False.

The astral package does not contains Sopot but it is easy to add it just by editing astral.py (before installation of course):

Sopot,Poland,54°44'N,18°55'E,Europe/Warsaw

A short test demonstrating that for Sopot and Warsow the script returns significantly different results:

./sun_calc.py -date 2013/01/21 -city Sopot -param dawn -verbose
solar_depressions: 6.0
Sopot 2013-01-21 09:17:11.368979+00:00 2013-01-21 06:09:47+00:00 (2013-01-21 07:09:47+01:00)
./sun_calc.py -date 2013/01/21 -city Warsaw -param dawn -verbose
solar_depressions: 6.0
Warsaw 2013-01-21 09:17:46.172157+00:00 2013-01-21 05:53:22+00:00 (2013-01-21 06:53:22+01:00)
True

So there is circa 15 minutes difference between Sopot which is some 300 km to the North from Warsaw.

url | Mon, 21/01/2013 10:24 | tagi: , , , , ,