Käyttäjä:Masa
masa on noob.
masa on myöskin sähkötekniikkaa "opiskeleva" noob.
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.
Gnome 3 keyboard shortcuts
dconf-editor -> org.gnome.desktop.wm.keybindings
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
Fix the clock
dconf-editor
org.gnome.shell.clock -> set show-date and show-seconds to true
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 extensios and configs
Installed, in use:
- https://extensions.gnome.org/extension/130/advanced-settings-in-usermenu/
- https://extensions.gnome.org/extension/15/alternatetab/
- https://extensions.gnome.org/extension/119/disable-window-animations/
- https://extensions.gnome.org/extension/99/evial-status-icon-forerver/
- https://extensions.gnome.org/extension/3/bottom-panel/
- https://extensions.gnome.org/extension/2/move-clock/
- https://extensions.gnome.org/extension/12/static-workspaces/
- https://extensions.gnome.org/extension/154/gmail-notify/
- https://extensions.gnome.org/extension/55/media-player-indicator/
- https://extensions.gnome.org/extension/150/message-notifier/
- https://extensions.gnome.org/extension/127/new-instance-on-current-workspace/
- https://extensions.gnome.org/extension/8/places-status-indicator/
- https://extensions.gnome.org/extension/109/pulse-audio-shortcuts/
- https://extensions.gnome.org/extension/72/recent-items/
(* https://github.com/simon04/gnome-shell-extension-weather dead?)
Installed, not in use:
- 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/13/applications-menu/
- https://extensions.gnome.org/extension/21/workspace-indicator/
- https://extensions.gnome.org/extension/28/gtile/
Not installed but interesting etc:
Gnome 3 extension configs
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 thier 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
Gnome 3 default applications
nano /usr/share/applications/mimeinfo.cache
nano ~/.local/share/applications/mimeapps.list
For default file manager, have this:
inode/directory=nautilus.desktop;Thunar-folder-handler.desktop;
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
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
DIR="/home/masa/ware/webcam/fswebcam"
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"
PWD=`pwd`
if [ -f "${COUNTERFILE}" ];
then
COUNTER=`cat ${COUNTERFILE}`
COUNTER=`expr ${COUNTER} + 1`
- let COUNTER=${COUNTER}+1
- COUNTER=$((${COUNTER}+1))
else
- COUNTER=1
COUNTER=`ls ${DIR}/webcam_*.jpg | wc -l`
COUNTER=`expr ${COUNTER} + 1`
fi
echo -n ${COUNTER} > ${COUNTERFILE}
FILENAME=`printf "webcam_%07d.jpg" ${COUNTER}`
- echo ${FILENAME}
- 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" ]
then
/usr/local/bin/fswebcam -c ${CONFIG_NIGHT} ${FILENAME}
else
/usr/local/bin/fswebcam -c ${CONFIG_DAY} ${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 and interpolate
- 2 for day, 4 for night
frames 4
- Number of frames to skip when starting capture
skip 15
- Delay (in seconds) after opening the device
- delay 2
- 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 the log file
- log fswebcam.log
The most important configs for a Funtoo installation
/etc/portage/package.use:
app-misc/gentoo -nls -fam
app-misc/tracker -applet
app-portage/eix -deprecated
app-portage/layman -bazaar -cvs git -mercurial -subversion
app-text/lcdf-typetools kpathsea # for texlive
dev-embedded/openocd ftdi segger usb versaloon
dev-java/sun-jdk nsplugin
dev-lang/python sqlite
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-util/cmake -qt4
dev-vcs/git gtk tk
gnome-base/gdm -fallback
gnome-base/gnome -fallback
gnome-base/gnome-vfs -gnutls
gnome-base/gvfs cdda gdu -udisks
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/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
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 g3dvl llvm vdpau video_cards_intel
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 vamp
media-sound/rhythmbox -cdr -gnome-keyring -lastfm
media-video/avidemux -amr -qt4
- avx for Core i5/i7:
media-video/ffmpeg aacplus amr avx celt gsm faac network vaapi vdpau vpx
media-video/libav amr celt gsm faac vpx
media-video/mkvtoolnix -qt4 -wxwidgets
media-video/mplayer amr openal pvr vaapi vdpau win32codecs
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/xulrunner java -networkmanager
net-misc/openssh -ldap
net-nds/openldap sasl # required on world update: cxx? ( sasl )
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
sys-libs/zlib minizip # required by chromium upgrade (2012-11-15)
virtual/udev gudev hwdb # 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
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:
- dev-embedded/openocd
sci-electronics/kicad
x11-drivers/xf86-video-intel
x11-libs/libdrm
- x11-drivers/xf86-video-ati
- x11-drivers/xf86-video-nouveau
=x11-proto/glproto-9999
- x11-proto/xf86driproto #for mesa 2012-04-09
media-libs/mesa
USE-flagit yms tärkeät muutokset /etc/make.conf:ssa:
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 bluetooth bzip2 cairo consolekit dbus dga dirac dvb\
exif faac 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_1\
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-10.3"
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-crypt/mcrypt
app-editors/gvim
app-editors/hexcurse
app-misc/screen
app-misc/tracker
app-misc/uptimed
app-portage/eix
app-portage/genlop
app-portage/gentoolkit
app-portage/layman
app-text/texlive-core
cross-avr/avr-libc
cross-avr/binutils
cross-avr/gcc
cross-msp430/msp430-binutils
cross-msp430/msp430-gcc
cross-msp430/msp430-libc
cross-msp430/msp430mcu
dev-embedded/avrdude
dev-embedded/openocd
dev-java/sun-jdk
dev-lang/erlang
dev-python/gnome-keyring-python
dev-texlive/texlive-langenglish
dev-texlive/texlive-langfinnish
dev-texlive/texlive-latex
dev-util/strace
dev-util/valgrind
dev-util/xdelta
dev-vcs/git
dev-vcs/gitg
gnome-base/gnome
gnome-extra/nautilus-dropbox
mail-client/mail-notification
media-fonts/corefonts
media-fonts/freefonts
media-fonts/ttf-bitstream-vera
media-gfx/gimp
media-gfx/gqview
media-gfx/gthumb
media-gfx/imagemagick
media-gfx/inkscape
media-gfx/wings
media-libs/esdl
media-libs/libgphoto2
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/paprefs
media-sound/pavucontrol
media-sound/pavumeter
media-sound/rhythmbox
media-sound/vorbis-tools
media-tv/linuxtv-dvb-apps
media-video/ffmpeg
media-video/mjpegtools
media-video/mkvtoolnix
media-video/mplayer
media-video/pitivi
media-video/projectx
media-video/x264-encoder
net-analyzer/vnstat
net-dns/dnsmasq
net-irc/irssi
net-libs/gnutls
net-misc/bridge-utils
net-misc/dhcpcd
net-misc/ntp
net-misc/openssh
net-misc/youtube-dl
net-p2p/linuxdcpp
sys-apps/gptfdisk
sys-apps/hdparm
sys-apps/pciutils
sys-apps/portage
sys-apps/smartmontools
sys-block/scsiadd
sys-boot/grub-legacy
sys-devel/bc
sys-devel/crossdev
sys-devel/gdb
sys-fs/lsscsi
sys-fs/reiserfsprogs
sys-power/acpid
sys-process/lsof
sys-process/vixie-cron
virtual/ffmpeg
www-client/firefox
www-plugins/adobe-flash
www-servers/lighttpd
x11-base/xorg-x11
x11-libs/libdrm
x11-plugins/pidgin-libnotify
x11-terms/gnome-terminal
x11-terms/xterm
x11-wm/fluxbox