Register now and start sharing your code snippets.
-->

Mount a network drive with proper privileges

Shell Script (Bash) posted about 1 year ago by marko

This is not a snippet either, but I always forget how the local permissions for a Samba mount are given, which is the reason I put it here. Uid is the id of the user you want to mount the drive as, and gid is respectively the group id. Username is the username you want to connect with.

   1  sudo mount -t smbfs -o uid=1000,gid=1000,username=marko //remote_server/work /mnt/net/stage/work

Tagged smbfs, samba, mount, smbmount, permissions, filesystem, network drive, linux

Disable pc speaker beep in Linux

Shell Script (Bash) posted about 1 year ago by marko

Not really a snippet, still a good fix for a big annoyance. Temporarily disable the speaker by removing the driver for it.

   1  sudo rmmod pcspkr

To make the silence more permanent add this line into /etc/modprob.d/blacklist

   1  blacklist pcspkr

Tagged pc speaker, linux, quiet, disable, audio, beep

Colorize grep

Shell Script (Bash) posted about 1 year ago by marko

Put this export in .bashrc to make grep colorize the text it found.

   1  export GREP_OPTIONS='--color=auto'

Tagged grep, bash, color, linux

Create a thumbnail of a movie.

Shell Script (Bash) posted about 1 year ago by marko

Create a thumbnail that is 320 wide by 240 high and five seconds into the movie.

   1  ffmpeg -i mymovie.avi -f mjpeg -t 0.001 -ss 5 -s "320x240" mymovie.jpg

Tagged thumbnail, movie, ffmpeg, jpg

Add duration metadata into flv movie

Shell Script (Bash) posted about 1 year ago by marko

By default an flv movie doesn’t contain the duration metadata. Using the flvtool2 program it is injected like this into the movie file.

   1  cat mymovie.flv | flvtool2 -U stdin mymovie.flv

Tagged flv, movie, flash, duration, metadata, flvtool2