Ero sivun ”Käyttäjä:Masa” versioiden välillä

Kulmapaikasta
Siirry navigaatioon Siirry hakuun
(Lisätty sticky pop-uppien disablointi)
(Add how to disable recently used files in GTK+)
 
(28 välissä olevaa versiota samalta käyttäjältä ei näytetä)
Rivi 1: Rivi 1:
masa on noob.
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 on myöskin sähkötekniikkaa "opiskeleva" noob.
=== 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 =====
<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:
<source>
cp -pi /etc/pulse/default.pa ~/.pulse/default.pa
</source>
 
Edit the config, add the following two lines to the end:
<source>
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
</source>
 
Restart PulseAudio by running pactl exit at the command line.


masa ylläpitää omaa palvelintaan, jonka nimi on tällä hetkellä dual. dualilla pyörii irssi, webbiserveri, pellettipolttimen logitussoftat ja suurelle yleisölle on tarjolla 24/7 toimiva Hard-vaikeustason KillingFloor-palvelin. Suunnitelmissa on tarjota lisää pelipalvelimia, kunhan joskus saan paremman nettiyhteyden kotiin.
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 <br />
http://superuser.com/questions/59481/how-to-swap-stereo-channels-in-ubuntu <br />
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules#module-remap-sink )


=== Gnome 3 keyboard shortcuts ===
==== Gnome 3: keyboard shortcuts ====
dconf-editor -> org.gnome.desktop.wm.keybindings
dconf-editor -> org.gnome.desktop.wm.keybindings


=== Get rid of the annoying sub-window thingies ===
==== 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 extensiot ja konffeja ===
==== Gnome 3: font hinting/antialiasing stuff ====
Asennettuna, käytössä:
Found in org.gnome.settings-daemon.plugins.xsettings
* https://extensions.gnome.org/extension/130/advanced-settings-in-usermenu/
 
==== 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)<br />
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 />
/usr/share/applications/<name>.desktop<br />
/usr/local/share/applications/<name>.desktop<br />
~/.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:<br />
org.gnome.desktop.interface.enable-animations -> set to false
 
==== Gnome 3: default applications ====
<source>
nano /usr/share/applications/mimeinfo.cache
nano ~/.local/share/applications/mimeapps.list
</source>
 
For default file manager, have for example this:
<source>
inode/directory=pcmanfm.desktop;nautilus.desktop;Thunar-folder-handler.desktop;
</source>
 
=== 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://extensions.gnome.org/extension/15/alternatetab/
* https://extensions.gnome.org/extension/119/disable-window-animations/
* https://github.com/windsorschmidt/disable-workspace-switcher-popup
* https://extensions.gnome.org/extension/99/evial-status-icon-forerver/
* https://extensions.gnome.org/extension/3/bottom-panel/
* https://extensions.gnome.org/extension/12/static-workspaces/
* https://extensions.gnome.org/extension/154/gmail-notify/
* 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/55/media-player-indicator/
* https://extensions.gnome.org/extension/150/message-notifier/
* https://extensions.gnome.org/extension/858/volume-mixer/
* https://extensions.gnome.org/extension/127/new-instance-on-current-workspace/
* https://extensions.gnome.org/extension/759/better-volume-indicator/
* https://extensions.gnome.org/extension/8/places-status-indicator/
* https://extensions.gnome.org/extension/613/weather/
* https://extensions.gnome.org/extension/109/pulse-audio-shortcuts/
* 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/72/recent-items/
* https://extensions.gnome.org/extension/28/gtile/
* https://extensions.gnome.org/extension/351/icon-hider/
* https://github.com/simon04/gnome-shell-extension-weather
* 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 ====
Asennettuna, ei käytössä:
* https://extensions.gnome.org/extension/294/shellshape/
* https://extensions.gnome.org/extension/288/active-notifications-indicator/
* https://extensions.gnome.org/extension/82/cpu-temperature-indicator/
* https://extensions.gnome.org/extension/82/cpu-temperature-indicator/
* https://extensions.gnome.org/extension/13/applications-menu/
* https://extensions.gnome.org/extension/21/workspace-indicator/
* https://extensions.gnome.org/extension/21/workspace-indicator/
 
* https://extensions.gnome.org/extension/288/active-notifications-indicator/
Ei asennettuna, mutta mielenkiintoisia tms:
* 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/mailnag
* https://github.com/pulb/shell-message-notifier
* 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) ====


==== Gnome 3 extensioiden konffeja ====
==== Evil Status Icon Forever ====
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
<code javascript n>
<source lang="js">
/*****************************************************
/*****************************************************
  * Statuc Icon Settings
  * Statuc Icon Settings
  ****************************************************/
  ****************************************************/


//
// Add application you want it shows their notification status
// Add application you want it shows thier notification status
// icon on top bar to the following list.
// icon on top bar to the following list.
//
 
// You may use top/htop to find out the name of application.
// You may use top/htop to find out the name of application.
//
 


var notification = [
var notification = [
Rivi 76: Rivi 164:
//    'wicd-client.py',  // Wicd-gtk
//    'wicd-client.py',  // Wicd-gtk
]
]


// Add which built-in status icon you want to remove in the
// Add which built-in status icon you want to remove in the
Rivi 94: Rivi 181:
  * Don't touch anything below!
  * Don't touch anything below!
  *****************************************************/
  *****************************************************/
</code>
</source>


=== Gnome 3 default applications ===
==== gnome-shell-extension-weather ====
 
<source lang="bash">
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
</source>
 
 
 
=== 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.
<source>
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
</source>
 
Another sometimes useful option fo x11grab:<br />
-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 ====
<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
</source>
 
==== Some random web stuff ====
 
Generate a SSL-key:
<source>
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes -days 1001
</source>


<code>
nano /usr/share/applications/mimeinfo.cache
nano ~/.local/share/applications/mimeapps.list
</code>


For default file manager, have this:
==== Random shell scripts ====
<code>
inode/directory=nautilus.desktop;Thunar-folder-handler.desktop;
</code>


=== Random shell scriptejä ===
Safely shutdown a SATA hard drive (spins it down). Umount first!
Safely shutdown a SATA hard drive (spins it down). Umount first!
Usage example: scsiremove /dev/sdb
Usage example: scsiremove /dev/sdb


/usr/local/bin/scsiremove (needs sys-block/scsiadd and sys-fs/lsscsi):
/usr/local/bin/scsiremove (needs sys-block/scsiadd and sys-fs/lsscsi):<br />
<code bash>
<source lang="bash">
#!/bin/sh
#!/bin/sh


Rivi 142: Rivi 265:


scsiadd -r $hcil
scsiadd -r $hcil
</code>
</source>


<hr />
<hr />
Rivi 148: Rivi 271:
Merge together video files in matroska containers (needs media-video/mkvtoolnix).
Merge together video files in matroska containers (needs media-video/mkvtoolnix).


/usr/local/bin/merge.sh:
/usr/local/bin/merge.sh:<br />
<code bash>
<source lang="bash">
#!/bin/bash
#!/bin/bash


Rivi 178: Rivi 301:
mkvmerge $ALL -o ${DSTDIR}${COMBINED}
mkvmerge $ALL -o ${DSTDIR}${COMBINED}
touch ${DSTDIR}${COMBINED} -r ${FIRST}
touch ${DSTDIR}${COMBINED} -r ${FIRST}
</code>
</source>


<hr />
<hr />
Rivi 184: Rivi 307:
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 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
encode.sh:<br />
<code bash>
<source lang="bash">
#!/bin/bash
#!/bin/bash


SRCDIR=/home/masa/Media/Fraps/Fraps/
SRCDIR=/home/masa/Media/Fraps/Fraps/
DSTDIR=/home/masa/ware/dc/f/
DSTDIR=/home/masa/f/


SAVEIFS=$IFS
SAVEIFS=$IFS
Rivi 221: Rivi 344:
done
done
IFS=$SAVEIFS
IFS=$SAVEIFS
</code>
</source>
 
<hr />
 
A script I used to symlink multishot screenshots into linearly increasingly named ones for ffmpeg encoding:
 
lnlinear.sh:<br />
<source lang="bash">
#!/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
</source>
 
<hr />
 
==== HDD/SSD/Filesystem check and repair related stuff ====
 
<source lang="bash">
# 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
</source>
 
http://smartmontools.sourceforge.net/badblockhowto.html <br />
(A local copy is found in /data/softa/text/tutorial/badblockhowto.html)
 
<hr />
 
==== Webcam stuff ====
Get the software here:<br />
http://www.firestorm.cx/fswebcam/
 
fswebcam.sh:<br />
<source lang="bash">
#!/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}
</source>
 
fswebcam_config.txt:<br />
<source>
# 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


=== Funtoon tärkeimmät konffit ===
# Set the subtitle
#subtitle Subtitle text
no-subtitle


/etc/portage/package.use:
# Set the info text
<code>
#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
</source>
 
<hr />
 
==== Filter out cron messages from /var/log/messages (using syslog-ng logger) ====
 
In /etc/syslog-ng/syslog-ng.conf, add and change:
<source>
# 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); };
</source>
 
==== The most important configs for a Funtoo installation (a bit outdated!) ====
 
/etc/portage/package.use/10-all:
<source>
app-misc/gentoo -nls -fam
app-misc/gentoo -nls -fam
app-misc/tracker -applet
app-misc/geoclue -modemmanager
app-misc/tracker -applet -ffmpeg
app-portage/eix -deprecated
app-portage/eix -deprecated
app-portage/layman -bazaar -cvs git -mercurial -subversion
app-portage/layman -bazaar -cvs git -mercurial -subversion
app-text/lcdf-typetools kpathsea # for texlive
app-text/lcdf-typetools kpathsea # for texlive
dev-embedded/openocd ftdi segger usb versaloon
dev-python/imaging -truetype
dev-embedded/libftdi -tools
dev-embedded/openocd ftdi segger stlink usb versaloon
dev-java/sun-jdk nsplugin
dev-java/sun-jdk nsplugin
dev-lang/python sqlite
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/folks eds # +eds for folks required by gnome-contacts via Gnome 3.4 upgrade
dev-libs/libxml2 icu # chromium (via deps?) needs +icu
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-util/cmake -qt4
dev-vcs/git gtk tk
dev-vcs/git gtk tk
gnome-base/gdm -fallback
gnome-base/gdm -fallback
gnome-base/gnome -fallback
gnome-base/gnome -fallback -extras # 2014-02-12 added -extras
gnome-base/gnome-vfs -gnutls
gnome-base/gnome-vfs -gnutls
gnome-base/gvfs cdda gdu -udisks
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
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-gfx/blender -ffmpeg # compilation fails with ffmpeg support enabled, probably because of ffmpeg -> libav change (??)
media-libs/freetype -infinality kpathsea -lcdfilter # kpathsea for texlive; -lcdfilter for cairo (2012-09-03); -infinality for Gnome 3.4 upgrade clean-up
media-libs/grilo playlist # 2014-10-15 required by totem-3.12
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
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/libpng apng # unofficial animated PNG support for ff 4.0.1
media-libs/libtheora encode
media-libs/libtheora encode
media-libs/mesa -gallium -g3dvl -llvm -xorg -xvmc -xa gbm -gles1 -gles2 video_cards_i965
media-libs/mesa -gallium -g3dvl -llvm -xorg -xvmc -xa gbm -gles1 -gles2 video_cards_i965
#media-libs/x264 -10bit
#media-libs/x264 10bit
media-plugins/alsa-plugins pulseaudio
media-plugins/alsa-plugins pulseaudio
media-plugins/audacious-plugins -ffmpeg
media-plugins/audacious-plugins -ffmpeg
media-sound/audacity id3tag vamp
media-sound/audacity id3tag ffmpeg vamp
media-sound/rhythmbox -cdr -gnome-keyring -lastfm
media-sound/rhythmbox -cdr -gnome-keyring -lastfm
media-sound/sox amr encode id3tag
media-video/avidemux -amr -qt4
media-video/avidemux -amr -qt4
# avx for Core i5/i7:
# avx for Core i5/i7:
media-video/ffmpeg aacplus amr avx celt gsm faac network vaapi vdpau vpx
media-video/ffmpeg aacplus amr celt gsm faac libsoxr network vaapi vdpau vpx
media-video/libav amr celt gsm faac vpx
media-video/libav amr avx celt gsm faac vpx
media-video/mkvtoolnix -qt4 -wxwidgets
media-video/mkvtoolnix -qt4 -wxwidgets
media-video/mplayer amr openal pvr vaapi vdpau win32codecs
media-video/mplayer amr openal pvr vaapi vdpau win32codecs
media-video/mpv vaapi vdpau
media-video/projectx java6
media-video/projectx java6
#media-video/x264-encoder -10bit
#media-video/x264-encoder -10bit
net-analyzer/vnstat gd
net-analyzer/vnstat gd
net-dns/dnsmasq -nls
net-dns/dnsmasq -nls
net-im/empathy -geocode # Gnome 3.4 upgrade related
net-im/empathy -geocode # Gnome 3.4 upgrade related clean-ups
net-im/pidgin -gstreamer gnutls
net-im/pidgin -gstreamer gnutls
net-im/skype qt-static
net-im/skype qt-static
net-libs/gtk-vnc gtk3
net-libs/gtk-vnc gtk3
net-libs/libssh server
net-libs/xulrunner java -networkmanager
net-libs/xulrunner java -networkmanager
net-misc/networkmanager -nss modemmanager -ppp
net-misc/openssh -ldap
net-misc/openssh -ldap
net-nds/openldap sasl # required on world update: cxx? ( sasl )
net-nds/openldap sasl # required on world update: cxx? ( sasl )
net-p2p/retroshare cli qt4
sci-visualization/gnuplot -pdf plotutils
sci-visualization/gnuplot -pdf plotutils
sys-apps/hal -crypt
sys-apps/hal -crypt
sys-apps/gnome-disk-utility fat
sys-apps/gnome-disk-utility fat
sys-block/parted device-mapper
sys-block/parted -device-mapper
sys-devel/gcc -gtk
sys-devel/gcc -gtk
sys-devel/gettext cvs git # avoid recompile by world updgrade (2012-09-03)
sys-devel/gettext cvs git # avoid recompile by world updgrade (2012-09-03)
sys-fs/udev extras
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-base/xorg-server -hal
x11-drivers/xf86-video-intel sna
x11-drivers/xf86-video-intel sna uxa
x11-libs/cairo cleartype directfb -lcdfilter
x11-libs/cairo cleartype directfb -lcdfilter
x11-libs/libdrm libkms video_cards_intel
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
dev-db/sqlite fts3 secure-delete # required by firefox-3.6
Rivi 295: Rivi 674:
cross-msp430/msp430-gcc -fortran -openmp -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc -multilib
cross-msp430/msp430-gcc -fortran -openmp -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc -multilib


cross-avr/avr-libc multilib -selinux
cross-avr/avr-libc -selinux multilib
cross-avr/binutils multilib -selinux
cross-avr/binutils -selinux multilib
cross-avr/gcc multilib -openmp -fortran -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc
cross-avr/gcc -fortran -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc multilib
cross-avr/gdb sys-devel gdb
cross-avr/gdb sys-devel gdb
cross-avr/insight dev-util insight
cross-avr/insight dev-util insight
</code>
</source>


/etc/portage/package.unmask:
/etc/portage/package.unmask/10-all:
<code>
<source>
#dev-embedded/openocd
dev-embedded/openocd
dev-libs/mpc
media-gfx/gthumb


sci-electronics/kicad
#sci-electronics/kicad


x11-drivers/xf86-video-intel
x11-drivers/xf86-video-intel
x11-libs/libdrm
x11-libs/libdrm
media-libs/mesa
</source>


#x11-drivers/xf86-video-ati
/etc/portage/package.mask/10-all:
#x11-drivers/xf86-video-nouveau
<source>
 
>=app-misc/gentoo-0.16
=x11-proto/glproto-9999
>=dev-embedded/avrdude-6
#x11-proto/xf86driproto #for mesa 2012-04-09
>=dev-embedded/libftdi-0.21
media-libs/mesa
>=dev-python/imaging-2
</code>
>=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
</source>


USE-flagit yms tärkeät muutokset /etc/make.conf:ssa:
USE-flags and other changes in /etc/make.conf:
<code>
<source lang="bash">
LINGUAS="en_GB"
LINGUAS="en_GB"
SANE_BACKENDS="niash"
SANE_BACKENDS="niash"
Rivi 333: Rivi 721:
-kde -libwww -musepack -networkmanager -php -qt -samba -xmlrpc\
-kde -libwww -musepack -networkmanager -php -qt -samba -xmlrpc\
X a52 aac acpi alsa\
X a52 aac acpi alsa\
avi bluetooth bzip2 cairo consolekit dbus dga dirac dvb\
avi avx bluetooth bzip2 cairo consolekit dbus dga dirac dvb\
exif faac fam ffmpeg firefox flac gif gimpprint gnome\
exif faac faad fam ffmpeg firefox flac gif gimpprint gnome\
gnome-keyring gnutls gphoto2 gtk gtk2\
gnome-keyring gnutls gphoto2 gtk gtk2\
gstreamer jpeg jpeg2k imagemagick imlib introspection lame lcms libnotify\
gstreamer jpeg jpeg2k imagemagick imlib introspection lame lcdfilter\
lm_sensors mad\
lcms libnotify lm_sensors mad\
matroska mmx mmxext mp3 mpeg msn nautilus nls nptl ogg\
matroska mmx mmxext mp3 mpeg msn nautilus nls nptl ogg\
oggvorbis opengl pdf png policykit pulseaudio qt3support\
oggvorbis opengl pdf png policykit pulseaudio qt3support\
scanner schroedinger sdl\
scanner schroedinger sdl\
speex spell sse sse2 sse3 ssse3 sse4_1\
speex spell sse sse2 sse3 ssse3 sse4 sse4_1 sse4_2\
svg tagwriting theora threads tiff truetype unicode usb v4l\
svg tagwriting theora threads tiff truetype unicode usb v4l\
v4l2 vorbis vpx win32codecs x264 xinerama xv xvmc xvid"
v4l2 vorbis vpx win32codecs x264 xinerama xv xvmc xvid"




ACCEPT_LICENSE="dlj-1.1 Oracle-BCLA-JavaSE cadsoft RTCW-ETEULA skype-eula AdobeFlash-10.3"
ACCEPT_LICENSE="dlj-1.1 Oracle-BCLA-JavaSE cadsoft RTCW-ETEULA skype-eula AdobeFlash-11.x"


CHOST="x86_64-pc-linux-gnu"
CHOST="x86_64-pc-linux-gnu"
Rivi 373: Rivi 761:


source /var/lib/layman/make.conf
source /var/lib/layman/make.conf
</code>
</source>


/var/lib/portage/world:
/var/lib/portage/world:


<code>
<source>
app-admin/conky
app-admin/conky
app-admin/gkrellm
app-admin/gkrellm
Rivi 384: Rivi 772:
app-admin/syslog-ng
app-admin/syslog-ng
app-arch/p7zip
app-arch/p7zip
app-arch/unrar
app-crypt/mcrypt
app-crypt/mcrypt
app-editors/curses-hexedit
app-editors/dhex
app-editors/ghex
app-editors/gvim
app-editors/gvim
app-editors/hexcurse
app-editors/hexcurse
app-editors/hexedit
app-editors/sublime-text
app-misc/gentoo
app-misc/screen
app-misc/screen
app-misc/uptimed
app-misc/uptimed
Rivi 394: Rivi 789:
app-portage/layman
app-portage/layman
app-text/texlive-core
app-text/texlive-core
app-text/xdvik
cross-avr/avr-libc
cross-avr/binutils
cross-msp430/msp430-binutils
cross-msp430/msp430-binutils
cross-msp430/msp430-gcc
cross-msp430/msp430-libc
cross-msp430/msp430mcu
dev-embedded/avrdude
dev-embedded/avrdude
dev-embedded/openocd
dev-embedded/libftdi
dev-java/sun-jdk
dev-embedded/mspdebug
dev-java/oracle-jdk-bin
dev-lang/jimtcl
dev-libs/openssl
dev-python/gnome-keyring-python
dev-python/gnome-keyring-python
dev-python/imaging
dev-texlive/texlive-fontsrecommended
dev-texlive/texlive-langenglish
dev-texlive/texlive-langenglish
dev-texlive/texlive-langfinnish
dev-texlive/texlive-langfinnish
dev-texlive/texlive-latex
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/valgrind
dev-util/xdelta
dev-util/xdelta
dev-vcs/git
dev-vcs/git
dev-vcs/gitg
dev-vcs/gitg
dev-vcs/mercurial
gnome-base/gnome
gnome-base/gnome
gnome-extra/gnome-calculator
gnome-extra/gnome-system-monitor
gnome-extra/gnome-tweak-tool
gnome-extra/nautilus-dropbox
gnome-extra/nautilus-dropbox
kde-misc/kdiff3
mail-client/mail-notification
mail-client/mail-notification
media-fonts/corefonts
media-fonts/corefonts
media-fonts/freefonts
media-fonts/freefonts
media-fonts/ttf-bitstream-vera
media-fonts/ttf-bitstream-vera
media-gfx/feh
media-gfx/gimp
media-gfx/gimp
media-gfx/gnome-font-viewer
media-gfx/gnome-screenshot
media-gfx/gpicview
media-gfx/gqview
media-gfx/gqview
media-gfx/gthumb
media-gfx/gthumb
media-gfx/imagemagick
media-gfx/imagemagick
media-gfx/inkscape
media-gfx/inkscape
media-gfx/scrot
media-gfx/viewnior
media-libs/libgphoto2
media-libs/libgphoto2
media-libs/libjpeg-turbo
media-libs/libtxc_dxtn
media-libs/libtxc_dxtn
media-libs/mesa
media-libs/mesa
Rivi 428: Rivi 848:
media-sound/audacity
media-sound/audacity
media-sound/mumble
media-sound/mumble
media-sound/ncmpcpp
media-sound/oggsplit
media-sound/ogmtools
media-sound/paprefs
media-sound/paprefs
media-sound/pavucontrol
media-sound/pavucontrol
media-sound/pavumeter
media-sound/pavumeter
media-sound/rhythmbox
media-sound/rhythmbox
media-sound/sox
media-sound/vorbis-tools
media-sound/vorbis-tools
media-tv/linuxtv-dvb-apps
media-tv/linuxtv-dvb-apps
media-video/ffmpeg
media-video/avidemux
media-video/mjpegtools
media-video/mkvtoolnix
media-video/mplayer
media-video/mplayer
media-video/pitivi
media-video/mpv
media-video/projectx
media-video/projectx
media-video/x264-encoder
net-analyzer/gnome-nettool
net-analyzer/nettop
net-analyzer/nmap
net-analyzer/traceroute
net-analyzer/vnstat
net-analyzer/vnstat
net-dns/dnsmasq
net-dns/dnsmasq
net-irc/irssi
net-irc/irssi
net-libs/gnutls
net-libs/gtk-vnc
net-misc/bridge-utils
net-misc/bridge-utils
net-misc/dhcpcd
net-misc/dhcpcd
net-misc/ntp
net-misc/ntp
net-misc/openssh
net-misc/vinagre
net-misc/youtube-dl
net-misc/youtube-dl
net-p2p/linuxdcpp
net-p2p/linuxdcpp
sci-electronics/eagle
sci-electronics/gerbv
sci-electronics/kicad
sys-apps/gptfdisk
sys-apps/gptfdisk
sys-apps/hdparm
sys-apps/hdparm
sys-apps/pciutils
sys-apps/pciutils
sys-apps/portage
sys-apps/portage
sys-apps/sdparm
sys-apps/smartmontools
sys-apps/smartmontools
sys-block/scsiadd
sys-block/scsiadd
sys-boot/grub-legacy
sys-boot/grub-legacy
sys-devel/bc
sys-devel/bc
sys-devel/crossdev
sys-devel/gcc
sys-devel/gdb
sys-fs/eudev
sys-fs/lsscsi
sys-fs/lsscsi
sys-fs/reiserfsprogs
sys-fs/reiserfsprogs
sys-fs/sshfs-fuse
sys-kernel/gentoo-sources
sys-power/acpid
sys-power/powertop
sys-process/lsof
sys-process/vixie-cron
sys-process/vixie-cron
virtual/ffmpeg
virtual/ffmpeg
www-client/chromium
www-client/firefox
www-client/firefox
www-plugins/adobe-flash
www-plugins/adobe-flash
Rivi 465: Rivi 912:
x11-drivers/xf86-video-intel
x11-drivers/xf86-video-intel
x11-libs/libdrm
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-plugins/pidgin-libnotify
x11-terms/eterm
x11-terms/gnome-terminal
x11-terms/gnome-terminal
x11-terms/roxterm
x11-terms/xterm
x11-terms/xterm
x11-wm/fluxbox
x11-wm/fluxbox
</code>
x11-wm/openbox
xfce-base/thunar
</source>
 
==== Random useful links ====
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/109/pulse-audio-shortcuts/ (not updated ;_;))

Installed, not in use

Not installed, outdated, etc. but interesting

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

HDD/SSD/Filesystem check and repair related stuff

# 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/