My blog for documenting computery problems after I figure them out. I try to include my problem solving steps, especially if I had to learn things for them too.
Wednesday, 7 October 2015
Why is Windows constantly writing to disk?
Sunday, 23 August 2015
Minecraft automatic starting, saving, and stopping
#! /bin/sh
### BEGIN INIT INFO
# Provides: minecraft
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Minecraft initscript
# Description: Start and Stop minecraft servers
### END INIT INFO
# Author: Amos Hayes <ahayes@polkaroo.net>
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Minecraft Servers"
NAME="minecraft"
SCRIPTNAME=/etc/init.d/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
screen -d -m -S minecraft_MyFirstServer \
su - minecraft -c 'cd MyFirstServer;java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui'
screen -d -m -S minecraft_MySecondServer \
su - minecraft -c 'cd MySecondServer;java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui'
}
#
# Function that stops the daemon/service
#
do_stop()
{
screen -S minecraft_MyFirstServer -p 0 -X stuff "/save-all$(printf \\r)/stop$(printf \\r)"
screen -S minecraft_MySecondServer -p 0 -X stuff "/save-all$(printf \\r)/stop$(printf \\r)"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac
:
Friday, 17 July 2015
Lossless rotation of MJPEG video
Write out the JPEG frames:
avconv -i WHOOPS.AVI -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
Rotate them losslessly:
exiftran -i -2 frame*.jpg
Reassemble the frames and grab the audio from the original file to create a new complete file:
avconv -framerate 29.97 -i frame_%d.jpg -i WHOOPS.AVI -codec copy /
-map 0:v -map 1:a ROTATED.AVI
Update: When this was originally written, Ubuntu was using the avconf fork of ffmpeg. These days, try replacing `avconv` in the commands above with `ffmpeg`.
Disconnect and power off USB peripheral from the Linux command line
I have a headless Proxmox PVE node that I sometimes need to mount USB storage to. When I'm done with it I can unmount the filesystem on ...
-
I have been working to prepare a digital atlas exhibit for the Natillik Heritage Centre in Gjoa Haven, Nunavut, Canada. Working with Indig...
-
Ubuntu Server 18.04 uses netplan instead of NetworkManager by default. ModemManager is still required to deal with modems and it requires N...