Installing postgresql should be easy right? Yes it is:
sudo apt-get install postgresql postgresql-client
sudo su - postgres
Of course there's more to nice setup than this, but I just needed to quickly
get a shell for trying some queries.
sources:
Encrypting partitions is fun, but also a bit unintuitive.
# install dependencies
sudo apt-get install cryptsetup
# setup luks on desired partition
sudo cryptsetup -y -v luksFormat /dev/sdb1
# init mapper device (and persist this setting)
sudo cryptsetup luksOpen /dev/sdb1 sdb1_crypt
sudo sh -c 'echo "sdb1_crypt /dev/sdb1 none luks" >> /etc/crypttab'
# format block device
sudo mkfs.ext4 /dev/mapper/sdb1_crypt
# add device to fstab
sudo mkdir /mountpoint
sudo sh -c 'echo "/dev/mapper/sdb1_crypt /mountpoint ext4 defaults 0 1" >> /etc/fstab'
# mount
sudo mount /mountpoint
sources:
I just put something like this in my crontab. It's quick and dirty, but it
works.
*/1 * * * * [ -z "`ps -ef | grep -v grep | grep '<command>'`" ] && <command>
For those rare cases when writing a daemon just does not pay off.
list your pulse devices:
pactl list
record with avconf (which is a weird version of ffmpeg):
avconv -video_size 1024x768 -framerate 20 -b $((10*1024))k -f x11grab -i $DISPLAY -f pulse -ac 2 -i "alsa_input.usb-0b0e_Jabra_SPEAK_510_USB_1C48F9E60C09020A00-00-USB.analog-mono" -threads 2 -vcodec libx264 -acodec mp3 -preset ultrafast output.mp4
Short and painless:
wget https://download2.ebz.epson.net/iscan/general/deb/x64/iscan-bundle-1.0.0.x64.deb.tar.gz
tar -xf iscan-bundle-1.0.0.x64.deb.tar.gz
sudo bash iscan-bundle-1.0.0.x64.deb/install.sh
grep epkowa /etc/sane.d/dll.conf \
|| sudo bash -c 'echo epkowa >> /etc/sane.d/dll.conf'
# you printer is very like different form 192.168.123.4
# so adjust accordingly
grep 'net 192\.168\.123\.4' /etc/sane.d/epkowa.conf \
|| sudo bash -c "echo 'net 192.168.123.4' >> /etc/sane.d/epkowa.conf"
This of course is a security nightmare so don't forget to do this only in a VM
or better yet on dedicated hardware with no sensitive data / network access.
resources:
If it comes to IDEs Eclipse is a beast. Here are some shorts-cuts I use
really a lot lately, they're for searching and navigating through code:
- search for files:
[Ctrl+Shift+r]
- search for java methods:
[Ctrl+Shift+m]
- search for java classes:
[Ctrl+Shift+t]
Packaging entire java projects into a single jar makes life easy. Why not
packaging web apps this way too? Here's how to do it with tomcat as app-server:
https://tomcat.apache.org/maven-plugin-2.0/executable-war-jar.html
I maintain a couple of maven projects. Here's what I do for checking
whether I should update dependencies:
mvn versions:display-dependency-updates
plugin docs: http://www.mojohaus.org/versions-maven-plugin
aka install a rpm package with alien
get java 1.8
get artifactory .rpm
-package: https://www.jfrog.com/open-source/
install it:
sudo adduser artifactory
sudo alien -k jfrog-artifactory-oss-4.2.2.rpm
sudo dpkg -i jfrog-artifactory-oss_4.2.2-40049_all.deb
Sometimes I run tasks over ssh without starting screen first. I tend to
regret that. So started experimenting with detaching running processes
from the shell. (I'm using zsh
btw. so this might not work with other
shells)
Note this is just experimental, don't expect this to work. And never
trust this for keeping critical processes alive.
# press [CRTL+Z] for putting a already running prozess in background
# display a list of jobs
jobs
# make a process run in background
bg %1
# keep the process running even when the termianl (ssh connection) quits
# in bash this should be: disown -h %1
disown %1
# find pids of disowned processes:
ps aux | grep commandName
# bring a disowned process to the foreground:
reptyr 1234
source: http://serverfault.com/questions/55880/moving-an-already-running-process-to-screen