Ero sivun ”Käyttäjä:Masa” versioiden välillä
(Save to fix source/code blocks?) |
(Add how to disable recently used files in GTK+) |
||
Rivi 3: | Rivi 3: | ||
masa ylläpitää omaa palvelintaan, jonka nimi on tällä hetkellä quad. quadilla pyörii irssi, webbiserveri, pellettipolttimen logitussoftat, git-repoja, Minecraft-palvelimia ja toisinaan sekalaisia muitakin pelipalvelimia. | masa ylläpitää omaa palvelintaan, jonka nimi on tällä hetkellä quad. quadilla pyörii irssi, webbiserveri, pellettipolttimen logitussoftat, git-repoja, Minecraft-palvelimia ja toisinaan sekalaisia muitakin pelipalvelimia. | ||
=== masa's random collection of Linux | === masa's random collection of Linux configuration stuffs === | ||
===== Swap the left and right channels with pulseaudio | ==== Disable the Recently used files list in GTK+ 2.x and GTK+ 3.x ==== | ||
===== In GTK+ 2.x ===== | |||
<source> | |||
rm ~/.local/share/recently-used.xbel | |||
echo gtk-recent-files-max-age=0 >> ~/.gtkrc-2.0 | |||
</source> | |||
<strong>Note:</strong> At least with LXAppearance installed, add that config value to the file ~/.gtkrc-2.0.mine instead! | |||
===== In GTK+ 3.x ===== | |||
<source> | |||
rm ~/.local/share/recently-used.xbel | |||
echo gtk-recent-files-max-age=0 >> ~/.config/gtk-3.0/settings.ini | |||
echo gtk-recent-files-limit=0 >> ~/.config/gtk-3.0/settings.ini | |||
</source> | |||
<strong>Note:</strong> If the file didn't exist, add "[Settings]" to the top of it! | |||
==== Swap the left and right channels with pulseaudio ==== | |||
Copy the following config: | Copy the following config: | ||
<source> | <source> | ||
Rivi 26: | Rivi 43: | ||
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules#module-remap-sink ) | http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules#module-remap-sink ) | ||
==== Gnome 3: keyboard shortcuts ==== | |||
dconf-editor -> org.gnome.desktop.wm.keybindings | dconf-editor -> org.gnome.desktop.wm.keybindings | ||
==== Gnome 3: Get rid of the annoying sub-window thingies ==== | |||
Open: dconf-editor<br /> | Open: dconf-editor<br /> | ||
Browse to: org -> gnome -> shell -> overrides -> attach-modal-dialogs<br /> | Browse to: org -> gnome -> shell -> overrides -> attach-modal-dialogs<br /> | ||
And set it to: false | And set it to: false | ||
==== Gnome 3: font hinting/antialiasing stuff ==== | |||
Found in org.gnome.settings-daemon.plugins.xsettings | Found in org.gnome.settings-daemon.plugins.xsettings | ||
==== Gnome 3: Fix the clock ==== | |||
Configured in gnome-tweak-tool | Configured in gnome-tweak-tool | ||
(used to be: dconf-editor: org.gnome.shell.clock -> show-date and show-seconds: true) | (used to be: dconf-editor: org.gnome.shell.clock -> show-date and show-seconds: true) | ||
==== Gnome 3: Add the minimize button ==== | |||
gnome-tweak-tool (Advanced Settings)<br /> | gnome-tweak-tool (Advanced Settings)<br /> | ||
Shell -> Arrangement of buttons on the title bar | Shell -> Arrangement of buttons on the title bar | ||
==== Gnome 3: application shortcuts/names/icons (with shell search) ==== | |||
Add and edit *.desktop files located in:<br /> | Add and edit *.desktop files located in:<br /> | ||
/usr/share/applications/<name>.desktop<br /> | /usr/share/applications/<name>.desktop<br /> | ||
Rivi 51: | Rivi 68: | ||
~/.local/share/applications/<name>.desktop | ~/.local/share/applications/<name>.desktop | ||
==== Gnome 3: Disable desktop animations ==== | |||
(This was previously done with an extension, see below in "not in use" section). | (This was previously done with an extension, see below in "not in use" section). | ||
dconf-editor:<br /> | dconf-editor:<br /> | ||
org.gnome.desktop.interface.enable-animations -> set to false | org.gnome.desktop.interface.enable-animations -> set to false | ||
==== Gnome 3: default applications ==== | |||
<source> | <source> | ||
nano /usr/share/applications/mimeinfo.cache | nano /usr/share/applications/mimeinfo.cache | ||
Rivi 67: | Rivi 84: | ||
</source> | </source> | ||
=== Gnome 3: useful extensions and configs === | |||
List updated for Gnome 3.12.x @ 2014-10-15 | List updated for Gnome 3.12.x @ 2014-10-15 | ||
==== Installed, in use: ==== | |||
* https://extensions.gnome.org/extension/15/alternatetab/ | * https://extensions.gnome.org/extension/15/alternatetab/ | ||
* https://github.com/windsorschmidt/disable-workspace-switcher-popup | * https://github.com/windsorschmidt/disable-workspace-switcher-popup | ||
Rivi 82: | Rivi 99: | ||
(* https://extensions.gnome.org/extension/109/pulse-audio-shortcuts/ (not updated ;_;)) | (* https://extensions.gnome.org/extension/109/pulse-audio-shortcuts/ (not updated ;_;)) | ||
==== Installed, not in use ==== | |||
* https://extensions.gnome.org/extension/3/bottom-panel/ (same functionality now available by default at least in Gnome 3.12) | * https://extensions.gnome.org/extension/3/bottom-panel/ (same functionality now available by default at least in Gnome 3.12) | ||
* https://extensions.gnome.org/extension/8/places-status-indicator/ broken? | * https://extensions.gnome.org/extension/8/places-status-indicator/ broken? | ||
Rivi 91: | Rivi 108: | ||
* https://extensions.gnome.org/extension/584/taskbar/ | * https://extensions.gnome.org/extension/584/taskbar/ | ||
==== Not installed, outdated, etc. but interesting ==== | |||
* https://extensions.gnome.org/extension/82/cpu-temperature-indicator/ | * https://extensions.gnome.org/extension/82/cpu-temperature-indicator/ | ||
* https://extensions.gnome.org/extension/21/workspace-indicator/ | * https://extensions.gnome.org/extension/21/workspace-indicator/ | ||
Rivi 115: | Rivi 132: | ||
* https://github.com/Neroth/gnome-shell-extension-weather (old URL, see extension 613) | * https://github.com/Neroth/gnome-shell-extension-weather (old URL, see extension 613) | ||
==== Gnome 3 extension configs (NOTE: outdated/not needed as of Gnome 3.12) ==== | |||
==== Evil Status Icon Forever ==== | |||
~/.local/share/gnome-shell/extensions/EvilStatusIconForever@bone.twbbs.org.tw/extensions.js | ~/.local/share/gnome-shell/extensions/EvilStatusIconForever@bone.twbbs.org.tw/extensions.js | ||
<source lang="js"> | <source lang="js"> | ||
Rivi 166: | Rivi 183: | ||
</source> | </source> | ||
==== gnome-shell-extension-weather ==== | |||
<source lang="bash"> | <source lang="bash"> | ||
Rivi 187: | Rivi 204: | ||
=== Some useful commands === | === Some useful commands === | ||
==== Record an area from the screen ==== | |||
Record a region from screen, with audio (can be used to record for example Minecraft). Shows the region outlines to align the window. | Record a region from screen, with audio (can be used to record for example Minecraft). Shows the region outlines to align the window. | ||
<source> | <source> | ||
Rivi 200: | Rivi 217: | ||
within PIXELS (greater than zero) to the edge of region. | within PIXELS (greater than zero) to the edge of region. | ||
==== Encode images into a (timelapse) video ==== | |||
<source> | <source> | ||
ffmpeg -f image2 -i ms_all/shot_%06d.png -r 25 -c:v libx264 -preset medium -crf 25 -an -threads 0 -f matroska rakennustapahtuma_2012-11-03_crf25_medium.mkv | ffmpeg -f image2 -i ms_all/shot_%06d.png -r 25 -c:v libx264 -preset medium -crf 25 -an -threads 0 -f matroska rakennustapahtuma_2012-11-03_crf25_medium.mkv | ||
</source> | </source> | ||
==== Some random web stuff ==== | |||
Generate a SSL-key: | Generate a SSL-key: | ||
Rivi 213: | Rivi 230: | ||
==== Random shell scripts ==== | |||
Safely shutdown a SATA hard drive (spins it down). Umount first! | Safely shutdown a SATA hard drive (spins it down). Umount first! | ||
Rivi 362: | Rivi 379: | ||
<hr /> | <hr /> | ||
==== HDD/SSD/Filesystem check and repair related stuff ==== | |||
<source lang="bash"> | <source lang="bash"> | ||
Rivi 380: | Rivi 397: | ||
<hr /> | <hr /> | ||
==== Webcam stuff ==== | |||
Get the software here:<br /> | Get the software here:<br /> | ||
http://www.firestorm.cx/fswebcam/ | http://www.firestorm.cx/fswebcam/ | ||
Rivi 547: | Rivi 564: | ||
<hr /> | <hr /> | ||
==== Filter out cron messages from /var/log/messages (using syslog-ng logger) ==== | |||
In /etc/syslog-ng/syslog-ng.conf, add and change: | In /etc/syslog-ng/syslog-ng.conf, add and change: | ||
Rivi 561: | Rivi 578: | ||
</source> | </source> | ||
==== The most important configs for a Funtoo installation (a bit outdated!) ==== | |||
/etc/portage/package.use/10-all: | /etc/portage/package.use/10-all: | ||
Rivi 910: | Rivi 927: | ||
</source> | </source> | ||
==== | ==== Random useful links ==== | ||
http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/ | http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/ |
Nykyinen versio 29. kesäkuuta 2015 kello 12.03
masa on noob. masa on myöskin sähkötekniikkaa "opiskeleva" noob. masa ylläpitää omaa palvelintaan, jonka nimi on tällä hetkellä quad. quadilla pyörii irssi, webbiserveri, pellettipolttimen logitussoftat, git-repoja, Minecraft-palvelimia ja toisinaan sekalaisia muitakin pelipalvelimia.
masa's random collection of Linux configuration stuffs
Disable the Recently used files list in GTK+ 2.x and GTK+ 3.x
In GTK+ 2.x
rm ~/.local/share/recently-used.xbel
echo gtk-recent-files-max-age=0 >> ~/.gtkrc-2.0
Note: At least with LXAppearance installed, add that config value to the file ~/.gtkrc-2.0.mine instead!
In GTK+ 3.x
rm ~/.local/share/recently-used.xbel
echo gtk-recent-files-max-age=0 >> ~/.config/gtk-3.0/settings.ini
echo gtk-recent-files-limit=0 >> ~/.config/gtk-3.0/settings.ini
Note: If the file didn't exist, add "[Settings]" to the top of it!
Swap the left and right channels with pulseaudio
Copy the following config:
cp -pi /etc/pulse/default.pa ~/.pulse/default.pa
Edit the config, add the following two lines to the end:
load-module module-remap-sink sink_name=reverse-stereo master=1 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right
set-default-sink reverse-stereo
Restart PulseAudio by running pactl exit at the command line.
This configuration makes a few basic assumptions: that the card you're reversing the channels of is card 0; that you only have to deal with 2 channels; and that those channels are called front-left and front-right. If you have a videocard with HDMI out, it is likely the analog out of your motherboard will be card 1, not 0; so master=1.
References:
(http://www.freedesktop.org/wiki/Software/PulseAudio/FAQ
http://superuser.com/questions/59481/how-to-swap-stereo-channels-in-ubuntu
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules#module-remap-sink )
Gnome 3: keyboard shortcuts
dconf-editor -> org.gnome.desktop.wm.keybindings
Gnome 3: Get rid of the annoying sub-window thingies
Open: dconf-editor
Browse to: org -> gnome -> shell -> overrides -> attach-modal-dialogs
And set it to: false
Gnome 3: font hinting/antialiasing stuff
Found in org.gnome.settings-daemon.plugins.xsettings
Gnome 3: Fix the clock
Configured in gnome-tweak-tool (used to be: dconf-editor: org.gnome.shell.clock -> show-date and show-seconds: true)
Gnome 3: Add the minimize button
gnome-tweak-tool (Advanced Settings)
Shell -> Arrangement of buttons on the title bar
Gnome 3: application shortcuts/names/icons (with shell search)
Add and edit *.desktop files located in:
/usr/share/applications/<name>.desktop
/usr/local/share/applications/<name>.desktop
~/.local/share/applications/<name>.desktop
Gnome 3: Disable desktop animations
(This was previously done with an extension, see below in "not in use" section).
dconf-editor:
org.gnome.desktop.interface.enable-animations -> set to false
Gnome 3: default applications
nano /usr/share/applications/mimeinfo.cache
nano ~/.local/share/applications/mimeapps.list
For default file manager, have for example this:
inode/directory=pcmanfm.desktop;nautilus.desktop;Thunar-folder-handler.desktop;
Gnome 3: useful extensions and configs
List updated for Gnome 3.12.x @ 2014-10-15
Installed, in use:
- https://extensions.gnome.org/extension/15/alternatetab/
- https://github.com/windsorschmidt/disable-workspace-switcher-popup
- https://extensions.gnome.org/extension/154/gmail-notify/
- https://extensions.gnome.org/extension/495/topicons/
- https://extensions.gnome.org/extension/55/media-player-indicator/
- https://extensions.gnome.org/extension/858/volume-mixer/
- https://extensions.gnome.org/extension/759/better-volume-indicator/
- https://extensions.gnome.org/extension/613/weather/
- https://extensions.gnome.org/extension/277/impatience/
(* https://extensions.gnome.org/extension/109/pulse-audio-shortcuts/ (not updated ;_;))
Installed, not in use
- https://extensions.gnome.org/extension/3/bottom-panel/ (same functionality now available by default at least in Gnome 3.12)
- https://extensions.gnome.org/extension/8/places-status-indicator/ broken?
- https://extensions.gnome.org/extension/72/recent-items/
- https://extensions.gnome.org/extension/351/icon-hider/
- https://extensions.gnome.org/extension/2/move-clock/
- https://extensions.gnome.org/extension/13/applications-menu/
- https://extensions.gnome.org/extension/584/taskbar/
Not installed, outdated, etc. but interesting
- https://extensions.gnome.org/extension/82/cpu-temperature-indicator/
- https://extensions.gnome.org/extension/21/workspace-indicator/
- https://extensions.gnome.org/extension/288/active-notifications-indicator/
- https://extensions.gnome.org/extension/130/advanced-settings-in-usermenu/
- https://extensions.gnome.org/extension/119/disable-window-animations/
- https://extensions.gnome.org/extension/99/evial-status-icon-forerver/
- https://extensions.gnome.org/extension/295/switch-output-audio-devices/
- https://extensions.gnome.org/extension/408/new-instance-with-wheel-button/
- https://extensions.gnome.org/extension/142/output-device-chooser-on-volume-menu/
- https://extensions.gnome.org/extension/127/new-instance-on-current-workspace/
- https://extensions.gnome.org/extension/150/message-notifier/
- https://extensions.gnome.org/extension/12/static-workspaces/
- https://extensions.gnome.org/extension/294/shellshape/
- https://extensions.gnome.org/extension/28/gtile/
- https://github.com/pulb/mailnag
- https://github.com/pulb/shell-message-notifier
- https://github.com/simon04/gnome-shell-extension-weather dead?
- https://extensions.gnome.org/extension/647/icon-area-horizontal-spacing/
- https://extensions.gnome.org/extension/237/desktop-icons-switch/
- https://extensions.gnome.org/extension/112/remove-accesibility/
- https://extensions.gnome.org/extension/212/advanced-volume-mixer/
- https://github.com/Neroth/gnome-shell-extension-weather (old URL, see extension 613)
Gnome 3 extension configs (NOTE: outdated/not needed as of Gnome 3.12)
Evil Status Icon Forever
~/.local/share/gnome-shell/extensions/EvilStatusIconForever@bone.twbbs.org.tw/extensions.js
/*****************************************************
* Statuc Icon Settings
****************************************************/
// Add application you want it shows their notification status
// icon on top bar to the following list.
// You may use top/htop to find out the name of application.
var notification = [
'pidgin', // Pidgin IM Client
'hime', // HIME Imput Method Editor
'dropbox', // Drop Box
'linuxdcpp', // LinuxDC++
'mail-notification',// mail-notification
'firefox', // Firefox with FireTray
'skype' // Skype
// 'deadbeef', // Deadbeef Music Player
// 'gcin', // GCIN Chinese Input Method
// 'thunderbird-bin', // Thunderbird-bin (Gentoo binary package)
// 'thunderbird', // Thunderbird
// 'firefox-bin', // Firefox-bin (Gentoo binary package)
// 'workrave', // Workrave
// 'gajim', // Gajim
// 'wicd-client.py', // Wicd-gtk
]
// Add which built-in status icon you want to remove in the
// following list.
//
var removeStatusIcon = [
'a11y', // Accessibility
// 'volume',
// 'battery',
// 'keyboard',
// 'bluetooth',
// 'network'
]
/******************************************************
* Don't touch anything below!
*****************************************************/
gnome-shell-extension-weather
git clone git://github.com/simon04/gnome-shell-extension-weather.git gnome-shell-extension-weather.git
cd gnome-shell-extension-weather.git
git checkout gnome3.4
./autogen.sh --prefix=/usr
make
sudo make install
gsettings set org.gnome.shell.extensions.weather unit celsius
gsettings set org.gnome.shell.extensions.weather wind-speed-unit m/s
gsettings set org.gnome.shell.extensions.weather city Lappeenranta
gsettings set org.gnome.shell.extensions.weather show-sunrise-sunset true
gsettings set org.gnome.shell.extensions.weather woeid FIXX0040
Some useful commands
Record an area from the screen
Record a region from screen, with audio (can be used to record for example Minecraft). Shows the region outlines to align the window.
ffmpeg -f x11grab -show_region 1 -r 25 -s 1280x720 -i :0.0+500,80 -c:v libx264 -preset fast -crf 22 -f alsa -i pulse -c:a libvorbis -b:a 96k -threads 0 -f matroska sda6/minecraft_withertaistelu_overview_2012-11-24_2.mkv
Another sometimes useful option fo x11grab:
-follow_mouse centered|<PIXELS>
When it is specified with "centered", the grabbing region follows the mouse pointer and keeps the pointer at the center of region; otherwise, the region follows only when the mouse pointer reaches within PIXELS (greater than zero) to the edge of region.
Encode images into a (timelapse) video
ffmpeg -f image2 -i ms_all/shot_%06d.png -r 25 -c:v libx264 -preset medium -crf 25 -an -threads 0 -f matroska rakennustapahtuma_2012-11-03_crf25_medium.mkv
Some random web stuff
Generate a SSL-key:
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes -days 1001
Random shell scripts
Safely shutdown a SATA hard drive (spins it down). Umount first! Usage example: scsiremove /dev/sdb
/usr/local/bin/scsiremove (needs sys-block/scsiadd and sys-fs/lsscsi):
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: $0 <device>"
exit 1
fi
if ! which lsscsi >/dev/null 2>&1; then
echo "Error: lsscsi not installed";
exit 1
fi
if ! which scsiadd >/dev/null 2>&1; then
echo "Error: scsiadd not installed"
exit 1
fi
device=`lsscsi | grep $1`
if [ -z "$device" ]; then
echo "Error: could not find device: $1"
exit 1
fi
hcil=`echo $device | awk \
'{split(substr($0, 2, 7),a,":"); print a[1], a[2], a[3], a[4]}'`
scsiadd -r $hcil
Merge together video files in matroska containers (needs media-video/mkvtoolnix).
/usr/local/bin/merge.sh:
#!/bin/bash
ALL="empty"
DSTDIR=${1}
FILES=${2}
for i in $(ls ${FILES}*)
do
if [ "$ALL" = "empty" ]; then
ALL=${i}
FIRST=${i}
else
ALL="${ALL} + ${i}"
fi
done
#COMBINED=$(basename $FIRST | sed "s/\.mkv/_all.mkv/")
COMBINED=`basename ${FIRST} | sed "s/\.\([a-zA-Z0-9]\{1,10\}\)$/_all\.\1/"`
if [ -f "${DSTDIR}${COMBINED}" ];
then
echo "Error: the target file already exists!"
exit
fi
#echo "mkvmerge $ALL -o ${DSTDIR}${COMBINED}"
mkvmerge $ALL -o ${DSTDIR}${COMBINED}
touch ${DSTDIR}${COMBINED} -r ${FIRST}
Encode videos into matroska container, with Ogg Vorbis audio and h.264 video (with x264 library). Needs media-video/ffmpeg, media-libs/libvorbis and media-libs/x264.
encode.sh:
#!/bin/bash
SRCDIR=/home/masa/Media/Fraps/Fraps/
DSTDIR=/home/masa/f/
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for i in $(ls ${SRCDIR}javaw*avi)
#for i in $(ls ${SRCDIR}KillingFloor*avi)
#for i in $(ls ${SRCDIR}*.avi)
#for i in $(ls ${SRCDIR}Terraria*avi)
do
# DST=$(echo ${i/avi/mkv})
# DST=$(echo ${i/ /_})
i=$(basename $i | sed "s/^\.\///")
# DST=$(echo $i | sed "s/avi/mkv/" | sed "s/ /_/g")
# DST=$(echo $i | sed "s/mpeg/mkv/" | sed "s/ /_/g")
DST=$(echo $i | sed "s/\.[a-zA-Z0-9]\{1,10\}$/\.mkv/" | sed "s/ /_/g")
# echo "$i -> $DST"
##########################
# Tämä on se perinteinen:
ffmpeg -i ${SRCDIR}"${i}" -c:a libvorbis -b:a 96k\
-r 25 -c:v libx264 -preset slow -crf 25 -threads 0\
-f matroska ${DSTDIR}${DST}
chown masa:masa ${DSTDIR}${DST}
chmod 644 ${DSTDIR}${DST}
touch ${DSTDIR}${DST} -r ${SRCDIR}"${i}"
done
IFS=$SAVEIFS
A script I used to symlink multishot screenshots into linearly increasingly named ones for ffmpeg encoding:
lnlinear.sh:
#!/bin/bash
#echo "?: $? #: $# 0: $0 1: $1 2: $2"
num=0
if [ $# -ne 1 ];
then
exit 1
fi
for i in `ls $1`
do
for j in `ls -tr ${1}/${i}`
do
num=`echo "${num} + 1" | bc`
#echo "$j -> ${num}"
#printf "$j -> shot_%06d.png\n" ${num}
name=`printf "shot_%06d.png\n" ${num}`
#echo $name
#echo "ln -s /home/masa/ms/${i}/${j} /home/masa/ms_all/${name}"
ln -s /home/masa/ms/${i}/${j} /home/masa/ms_all/${name}
done
done
# Run a read-only badblocks test on a ext2/ext3/ext4 filesystem
e2fsck -c -v /dev/sda7
# Run a non-destructive read-write badblocks test on a ext2/ext3/ext4 filesystem
e2fsck -c -c -v /dev/sda7
# Show the list of known bad blocks on a ext2/ext3/ext4 filesystem
dumpe2fs -b /dev/sda7
http://smartmontools.sourceforge.net/badblockhowto.html
(A local copy is found in /data/softa/text/tutorial/badblockhowto.html)
Webcam stuff
Get the software here:
http://www.firestorm.cx/fswebcam/
fswebcam.sh:
#!/bin/bash
DSTPATH="/home/masa/ware/webcam/"
#DSTPATH="/home/masa/ware/webcam/fswebcam_2013-05-25_2"
CONFIG_NIGHT="/home/masa/.fswebcam_config_night.txt"
CONFIG_DAY="/home/masa/.fswebcam_config_day.txt"
COUNTERFILE="/tmp/fswebcam_counter.txt"
#TIMESTAMP=`date "+%Y-%m-%d_%H-%M-%S"`
#FILENAME="webcam_${TIMESTAMP}.jpg"
MONTH=`date "+%Y-%m"`
DIR="${DSTPATH}${MONTH}/"
FILENAMEFORMAT="webcam_%08d.jpg"
#PWD=`pwd`
if [ ! -d "${DIR}" ];
then
echo "foo"
# mkdir ${DIR}
fi
if [ -f "${COUNTERFILE}" ];
then
COUNTER=`cat ${COUNTERFILE}`
COUNTER=`expr ${COUNTER} + 1`
# let COUNTER=${COUNTER}+1
# COUNTER=$((${COUNTER}+1))
FILENAME=`printf ${FILENAMEFORMAT} ${COUNTER}`
if [ -f "${DIR}${FILENAME}" ];
then
# COUNTER=`ls ${DIR}webcam_*.jpg | wc -l`
# Take the last file's number and increment it by one
COUNTER=`ls ${DIR}webcam_*.jpg | tail -n 1 | sed "s/.*webcam_\([0-9]\+\)\.jpg/\1/"`
COUNTER=`expr ${COUNTER} + 1`
fi
else
# COUNTER=1
# COUNTER=`ls ${DIR}/webcam_*.jpg | wc -l`
# Take the last file's number and increment it by one
COUNTER=`ls ${DIR}webcam_*.jpg | tail -n 1 | sed "s/.*webcam_\([0-9]\+\)\.jpg/\1/"`
COUNTER=`expr ${COUNTER} + 1`
fi
echo -n ${COUNTER} > ${COUNTERFILE}
FILENAME=`printf ${FILENAMEFORMAT} ${COUNTER}`
##### DEBUGGING #######
#ls ${DIR}webcam_*.jpg
#echo "DIR: ${DIR}"
#echo "FILENAME: ${FILENAME}"
#NUM=`ls ${DIR}webcam_*.jpg | tail -n 1 | sed "s/.*webcam_\([0-9]\+\)\.jpg/\1/"`
#echo "NUM: ${NUM}"
#FOO=`ls /tttmp/webcam_*.jpg | tail -n 1 | sed "s/.*webcam_\([0-9]\+\)\.jpg/\1/"`
#FOO=`expr ${FOO} + 1`
#echo "FOO: $FOO"
#exit
#######################
#cd ${DIR}
# Use separate configs for day and night so we can adjust the number of samples
# we take and interpolate, because night time shots have more noise.
# During winter, consider hours between 16..08 as night (= dark).
#if [ "`date +%H`" -ge "16" ] || [ "`date +%H`" -le "08" ]
# During summer, consider hours between 23..03 as night (= dark-er).
if [ "`date +%H`" -ge "23" ] || [ "`date +%H`" -lt "04" ]
then
/usr/local/bin/fswebcam -c ${CONFIG_NIGHT} ${DIR}${FILENAME}
else
/usr/local/bin/fswebcam -c ${CONFIG_DAY} ${DIR}${FILENAME}
fi
#cd ${PWD}
fswebcam_config.txt:
# config file for fswebcam
# Device
device v4l2:/dev/video0
# Input
input 0
# Palette to use
palette MJPEG
# Resolution
resolution 1280x720
# The number of frames to capture
# Interpolate 4 frames during night (= dark and noisy)
frames 4
# Interpolrate 1 or 2 frames during day (= bright)
#frames 1
# Number of frames to skip when starting capture
skip 15
# Delay (in seconds) after opening the device
#delay 1
# Continually capture images with interval of 60 seconds
#loop 60
# Offset when loop recording
#offset 1
# Draw the banner at the bottom of the screen
bottom-banner
# Select the font to use and a size
font /usr/share/fonts/corefonts/verdana.ttf:14
# Set the main title
#title Title text
no-title
# Set the subtitle
#subtitle Subtitle text
no-subtitle
# Set the info text
#info Info text
no-info
# Banner colour
#banner-colour #40263A93
banner-colour #FF000000
# Separator line colour
#line-colour #00FF0000
line-colour #FF000000
# Text colour
text-colour #00FFFFFF
# Enable or disable text shadow
shadow
#no-shadow
# Set the timestamp format
timestamp "%Y-%m-%d %H:%M:%S"
# Select the image format and compression level
jpeg 85
#png 9
# Set some controls
#set "Power Line Frequency"="50 Hz"
#set "Brightness"="0"
# Set the log file
#log fswebcam.log
Filter out cron messages from /var/log/messages (using syslog-ng logger)
In /etc/syslog-ng/syslog-ng.conf, add and change:
# Create a filter:
filter f_croninfo { level(info) and not facility(cron); };
# for example before the line:
destination messages { file("/var/log/messages"); };
# Add the following and comment the original line
log { source(src); filter(f_croninfo); destination(messages); };
#log { source(src); destination(messages); };
The most important configs for a Funtoo installation (a bit outdated!)
/etc/portage/package.use/10-all:
app-misc/gentoo -nls -fam
app-misc/geoclue -modemmanager
app-misc/tracker -applet -ffmpeg
app-portage/eix -deprecated
app-portage/layman -bazaar -cvs git -mercurial -subversion
app-text/lcdf-typetools kpathsea # for texlive
dev-python/imaging -truetype
dev-embedded/libftdi -tools
dev-embedded/openocd ftdi segger stlink usb versaloon
dev-java/sun-jdk nsplugin
dev-lang/python sqlite
dev-libs/DirectFB vdpau
dev-libs/folks eds # +eds for folks required by gnome-contacts via Gnome 3.4 upgrade
dev-libs/libxml2 icu # chromium (via deps?) needs +icu
#dev-python/setuptools python_abis_3.2 # required by Chromium update via python deps 2014-02-06
dev-util/cmake -qt4
dev-vcs/git gtk tk
gnome-base/gdm -fallback
gnome-base/gnome -fallback -extras # 2014-02-12 added -extras
gnome-base/gnome-vfs -gnutls
gnome-base/gvfs udisks
gnome-extra/evolution-data-server vala # required by upgrades on 2014-10-14
mail-client/mail-notification gmail imap pop ssl
media-gfx/blender -ffmpeg # compilation fails with ffmpeg support enabled, probably because of ffmpeg -> libav change (??)
media-libs/grilo playlist # 2014-10-15 required by totem-3.12
media-libs/freetype -infinality kpathsea -lcdfilter # kpathsea for texlive; -lcdfilter for cairo (2012-09-03); -infinality for Gnome 3.4 upgrade clean-up; infinality and lcdfilter enabled 2012-10-27 for better fonts; screw that, disabled again 2012-10-30; infinality enabled again 2014-02-10, required by eselect-lcdfilter-2
media-libs/fontconfig cleartype -lcdfilter # -lcdfilter for these required by world update via some deps (2012-07-23); cleartype added 2012-09-03 via cairo dep; lcdfilter enabled 2012-10-27; disabled 2012-10-30
media-libs/libpng apng # unofficial animated PNG support for ff 4.0.1
media-libs/libtheora encode
media-libs/mesa -gallium -g3dvl -llvm -xorg -xvmc -xa gbm -gles1 -gles2 video_cards_i965
#media-libs/x264 10bit
media-plugins/alsa-plugins pulseaudio
media-plugins/audacious-plugins -ffmpeg
media-sound/audacity id3tag ffmpeg vamp
media-sound/rhythmbox -cdr -gnome-keyring -lastfm
media-sound/sox amr encode id3tag
media-video/avidemux -amr -qt4
# avx for Core i5/i7:
media-video/ffmpeg aacplus amr celt gsm faac libsoxr network vaapi vdpau vpx
media-video/libav amr avx celt gsm faac vpx
media-video/mkvtoolnix -qt4 -wxwidgets
media-video/mplayer amr openal pvr vaapi vdpau win32codecs
media-video/mpv vaapi vdpau
media-video/projectx java6
#media-video/x264-encoder -10bit
net-analyzer/vnstat gd
net-dns/dnsmasq -nls
net-im/empathy -geocode # Gnome 3.4 upgrade related clean-ups
net-im/pidgin -gstreamer gnutls
net-im/skype qt-static
net-libs/gtk-vnc gtk3
net-libs/libssh server
net-libs/xulrunner java -networkmanager
net-misc/networkmanager -nss modemmanager -ppp
net-misc/openssh -ldap
net-nds/openldap sasl # required on world update: cxx? ( sasl )
net-p2p/retroshare cli qt4
sci-visualization/gnuplot -pdf plotutils
sys-apps/hal -crypt
sys-apps/gnome-disk-utility fat
sys-block/parted -device-mapper
sys-devel/gcc -gtk
sys-devel/gettext cvs git # avoid recompile by world updgrade (2012-09-03)
sys-fs/udev extras keymap # keymap added 2014-04-05 for x11-drivers
sys-libs/zlib minizip # required by chromium upgrade (2012-11-15)
sys-power/upower deprecated # 2014-10-15 needed to fix telepathy-mission-control not building
virtual/udev gudev hwdb keymap # required by gst-plugins-v4l2 -> ... -> pitivi (2012-12-05)
x11-base/xorg-server -hal
x11-drivers/xf86-video-intel sna uxa
x11-libs/cairo cleartype directfb -lcdfilter
x11-libs/libdrm libkms video_cards_intel
x11-libs/libfm -automount
x11-libs/libva vdpau
# For mkvtoolnix upgrade 2014-02-10: # 20 needed via virtual/rubygems funny dep I think @ 2014-02-12
dev-ruby/json -ruby_targets_ruby18 ruby_targets_ruby19
dev-ruby/racc -ruby_targets_ruby18 ruby_targets_ruby19
dev-ruby/rake -ruby_targets_ruby18 ruby_targets_ruby19
dev-ruby/rdoc -ruby_targets_ruby18 ruby_targets_ruby19
dev-ruby/rubygems -ruby_targets_ruby18 ruby_targets_ruby19
dev-db/sqlite fts3 secure-delete # required by firefox-3.6
www-client/firefox java -networkmanager
cross-msp430-unknown-elf-gnu/binutils -selinux
cross-msp430/msp430-gdb dev-embedded msp430-gdb
cross-msp430/insight dev-util insight
cross-msp430/msp430-binutils -selinux -multilib
cross-msp430/msp430mcu -selinux -multilib
cross-msp430/msp430-libc -selinux -multilib
cross-msp430/msp430-gcc -fortran -openmp -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc -multilib
cross-avr/avr-libc -selinux multilib
cross-avr/binutils -selinux multilib
cross-avr/gcc -fortran -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc multilib
cross-avr/gdb sys-devel gdb
cross-avr/insight dev-util insight
/etc/portage/package.unmask/10-all:
dev-embedded/openocd
dev-libs/mpc
media-gfx/gthumb
#sci-electronics/kicad
x11-drivers/xf86-video-intel
x11-libs/libdrm
media-libs/mesa
/etc/portage/package.mask/10-all:
>=app-misc/gentoo-0.16
>=dev-embedded/avrdude-6
>=dev-embedded/libftdi-0.21
>=dev-python/imaging-2
>=dev-java/oracle-jdk-bin-1.8
>dev-vcs/gitg-0.2.7 # 2014-02-12 mask for requiring masked gtksourceview and webkit-gtk versions
>=sci-electronics/eagle-5
>sci-electronics/kicad-20120119_p3256
>=www-client/chromium-35
USE-flags and other changes in /etc/make.conf:
LINGUAS="en_GB"
SANE_BACKENDS="niash"
CAMERAS="canon ptp2"
INPUT_DEVICES="keyboard mouse evdev"
VIDEO_CARDS="i965 intel vesa"
RUBY_TARGETS="ruby18" # to limit the dependencies for mkvtoolnix
USE=" -arts -cups -eds -hal -java -javascript\
-kde -libwww -musepack -networkmanager -php -qt -samba -xmlrpc\
X a52 aac acpi alsa\
avi avx bluetooth bzip2 cairo consolekit dbus dga dirac dvb\
exif faac faad fam ffmpeg firefox flac gif gimpprint gnome\
gnome-keyring gnutls gphoto2 gtk gtk2\
gstreamer jpeg jpeg2k imagemagick imlib introspection lame lcdfilter\
lcms libnotify lm_sensors mad\
matroska mmx mmxext mp3 mpeg msn nautilus nls nptl ogg\
oggvorbis opengl pdf png policykit pulseaudio qt3support\
scanner schroedinger sdl\
speex spell sse sse2 sse3 ssse3 sse4 sse4_1 sse4_2\
svg tagwriting theora threads tiff truetype unicode usb v4l\
v4l2 vorbis vpx win32codecs x264 xinerama xv xvmc xvid"
ACCEPT_LICENSE="dlj-1.1 Oracle-BCLA-JavaSE cadsoft RTCW-ETEULA skype-eula AdobeFlash-11.x"
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS="~amd64"
PORTDIR_OVERLAY=/usr/local/portage
FETCHCOMMAND="/usr/bin/wget -t 5 -T 60 -nv --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 -nv --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
SYNC="git://github.com/funtoo/ports-2012.git"
MAKEOPTS="-j5"
FEATURES="ccache mini-manifest sandbox"
CCACHE_SIZE="1G"
PORTAGE_ELOG_CLASSES="warn error log info qa"
PORTAGE_ELOG_SYSTEM="save"
source /var/lib/layman/make.conf
/var/lib/portage/world:
app-admin/conky
app-admin/gkrellm
app-admin/pwgen
app-admin/sudo
app-admin/syslog-ng
app-arch/p7zip
app-arch/unrar
app-crypt/mcrypt
app-editors/curses-hexedit
app-editors/dhex
app-editors/ghex
app-editors/gvim
app-editors/hexcurse
app-editors/hexedit
app-editors/sublime-text
app-misc/gentoo
app-misc/screen
app-misc/uptimed
app-portage/eix
app-portage/genlop
app-portage/gentoolkit
app-portage/layman
app-text/texlive-core
app-text/xdvik
cross-avr/avr-libc
cross-avr/binutils
cross-msp430/msp430-binutils
dev-embedded/avrdude
dev-embedded/libftdi
dev-embedded/mspdebug
dev-java/oracle-jdk-bin
dev-lang/jimtcl
dev-libs/openssl
dev-python/gnome-keyring-python
dev-python/imaging
dev-texlive/texlive-fontsrecommended
dev-texlive/texlive-langenglish
dev-texlive/texlive-langfinnish
dev-texlive/texlive-latex
dev-texlive/texlive-pictures
dev-util/beediff
dev-util/ccache
dev-util/diffuse
dev-util/geany
dev-util/imediff2
dev-util/strace
dev-util/tkdiff
dev-util/valgrind
dev-util/xdelta
dev-vcs/git
dev-vcs/gitg
dev-vcs/mercurial
gnome-base/gnome
gnome-extra/gnome-calculator
gnome-extra/gnome-system-monitor
gnome-extra/gnome-tweak-tool
gnome-extra/nautilus-dropbox
kde-misc/kdiff3
mail-client/mail-notification
media-fonts/corefonts
media-fonts/freefonts
media-fonts/ttf-bitstream-vera
media-gfx/feh
media-gfx/gimp
media-gfx/gnome-font-viewer
media-gfx/gnome-screenshot
media-gfx/gpicview
media-gfx/gqview
media-gfx/gthumb
media-gfx/imagemagick
media-gfx/inkscape
media-gfx/scrot
media-gfx/viewnior
media-libs/libgphoto2
media-libs/libjpeg-turbo
media-libs/libtxc_dxtn
media-libs/mesa
media-libs/x264
media-sound/alsa-utils
media-sound/audacious
media-sound/audacity
media-sound/mumble
media-sound/ncmpcpp
media-sound/oggsplit
media-sound/ogmtools
media-sound/paprefs
media-sound/pavucontrol
media-sound/pavumeter
media-sound/rhythmbox
media-sound/sox
media-sound/vorbis-tools
media-tv/linuxtv-dvb-apps
media-video/avidemux
media-video/mjpegtools
media-video/mkvtoolnix
media-video/mplayer
media-video/mpv
media-video/projectx
net-analyzer/gnome-nettool
net-analyzer/nettop
net-analyzer/nmap
net-analyzer/traceroute
net-analyzer/vnstat
net-dns/dnsmasq
net-irc/irssi
net-libs/gnutls
net-libs/gtk-vnc
net-misc/bridge-utils
net-misc/dhcpcd
net-misc/ntp
net-misc/openssh
net-misc/vinagre
net-misc/youtube-dl
net-p2p/linuxdcpp
sci-electronics/eagle
sci-electronics/gerbv
sci-electronics/kicad
sys-apps/gptfdisk
sys-apps/hdparm
sys-apps/pciutils
sys-apps/portage
sys-apps/sdparm
sys-apps/smartmontools
sys-block/scsiadd
sys-boot/grub-legacy
sys-devel/bc
sys-devel/crossdev
sys-devel/gcc
sys-devel/gdb
sys-fs/eudev
sys-fs/lsscsi
sys-fs/reiserfsprogs
sys-fs/sshfs-fuse
sys-kernel/gentoo-sources
sys-power/acpid
sys-power/powertop
sys-process/lsof
sys-process/vixie-cron
virtual/ffmpeg
www-client/chromium
www-client/firefox
www-plugins/adobe-flash
www-servers/lighttpd
x11-base/xorg-x11
x11-drivers/xf86-video-intel
x11-libs/libdrm
x11-libs/libvdpau-va-gl
x11-misc/gcolor2
x11-misc/lightdm
x11-misc/pcmanfm
x11-misc/vdpauinfo
x11-plugins/pidgin-libnotify
x11-terms/eterm
x11-terms/gnome-terminal
x11-terms/roxterm
x11-terms/xterm
x11-wm/fluxbox
x11-wm/openbox
xfce-base/thunar
Random useful links
http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/