Various random notings that I make for future reference...
When piping filenames which include spaces through xargs delimit with null characters instead of newlines:
$ find . -type f -print0 | xargs --null ls -ltrd
A minimal postfix configuration which delivers all email to a local user:
# The alias is still useful for redirecting local users like root alias_maps = hash:/etc/aliases # Only allow local connections inet_interfaces = loopback-only # Force the delivery transport to be local default_transport = local # Redirect any unknown recipient to a local user luser_relay = my_user
Any email sent via the local postfix will end up either at a local user/alias or at my_user. To be completely safe it would be a good idea to block outgoing SMTP traffic.
To store ALSA sound (including volume) settings between reboots:
sudo alsactl store
apt trusted keys:
W: GPG error: http://apt-mirror-url distro Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXXXXXXXX
Grab a key and import:
$ gpg --keyserver pgp.mit.edu --recv-keys XXXXXXXXXXXXXXXX $ gpg --armor --export XXXXXXXXXXXXXXXX | apt-key add -
Setting up the locale for linux after a minimal installation. Often the locale is not generated yet - to do this:
locale-gen $LANG
Further notes in my wiki: Setting Up Locales
Capturing key codes in X Windows - I keep forgetting this so I'm writing
it down. The application that helps you out is xev<1)
:
$ xev Outer window is 0x4000001, inner window is 0x4000002 KeyRelease event, serial 32, synthetic NO, window 0x4000001, root 0x59, subw 0x0, time 379713580, (0,135), root:(296,319), state 0x0, keycode 13 (keysym 0x34, 4), same_screen YES, XLookupString gives 1 bytes: (34) "4" XFilterEvent returns: False KeyPress event, serial 32, synthetic NO, window 0x4000001, root 0x59, subw 0x0, time 379713790, (0,135), root:(296,319), state 0x0, keycode 11 (keysym 0x32, 2), same_screen YES, XLookupString gives 1 bytes: (32) "2" XmbLookupString gives 1 bytes: (32) "2" XFilterEvent returns: False
Updating a bunch of music files with useful names but no id3 tags:
$ find . -type f \ | perl -n -l -e '($n,$t)=m{/0*(\d+)_(.*?)\.mp3}; $t =~ tr/_/ /; $t =~ s/(\w+)/\u\L$1/g; `id3 -t "$t" -T "$n" $_`;'
To configure a new virtual interface in Solaris:
- To set up virtual interfaces for boot time:
$ echo "new_hostname" > /etc/hostname.hme0:1 $ echo "XXX.XXX.XXX.XXX new_hostname.domain new_hostname" >> /etc/hosts
- To start up the interface without rebooting:
$ ifconfig hme0:1 plumb $ ifconfig hme0:1 XXX.XXX.XXX.XXX up
Dell priority support: 1800 060 889
mod_ssi variable substitution
To use mod_ssi includes of standard headers/footers etc SSI variable substitution can be used, using these commands:
<!--#echo var="varname" encoding="entity" -->
<!--#set var="varname" value="varvalue" -->
<!--#if expr="$varname != ''" -->
<!--#else -->
<!--#endif -->
CVS Repository locking
CVS lock files are on a directory basis so they need to exist in every directory (excluding CVS and Attic directories) to lock an entire repository
<INFO> is an arbitrary string to be appended to the end of each lock filename in for the use of the CVS administrators.
Read Lock:
- Create #cvs.lock directory
- Create #cvs.rfl.<INFO> file
- Remove #cvs.lock directory
- Read
- Remove #cvs.rfl.<INFO> file
Write Lock:
- Create #cvs.lock directory
- Check for #cvs.rfl.* (abort if there)
- Create #cvs.wfl.<INFO> file
- Write to repository
- Remove #cvs.wfl.<INFO> file
- Remoe #cvs.lock directory
To avoid deadlock:
remove all locks on failure to attain full lock
For Backup:
Use a Read Lock
grif processing embedded eps files - a note about photoshop
Just so you know (in case this happens to someone else who uses photoshop). I used the default eps settings. I turned off TIFF preview and "Include halftone" screen, and it all works fine (abiet very low quality, but hey it works!).
openssl certificate handling...
- To convert a PEM certificate to DER (p12):
openssl pkcs12 -export -in <pemfile> -out <derfile>
- To convert a DER (p12) certificate to PEM:
Note: The PEM file created includes the private key, then the CA public cert and finally the public cert. openssl pkcs12 -nodes -in <derfile> -out <pemfile>
- To generate a private key (1024bit, DES encrypted):
openssl genrsa -out private.key -des 1024
- To generate a self-signed certificate (given an existing private key):
openssl req -new -x509 -key <path-to-private-key> -out self-signed.pem -days 3650
- Createing the hash symlink to a certificate (e.g. in /etc/ssl/certs):
ln -s some-cert.pem `openssl x509 -noout -hash -in some-cert.pem`.0
(Tue Dec 20 11:13:27 EST 2016) I wrote those notes a while back, these days for HTTPS support life is very easy thanks to LetsEncrypt and the certbot utility.
A handy a2ps printing line...
a2ps --delegate=no --pretty-print=html --columns=1 --landscape --chars-per-line=160 filename
FrameMaker core dumping when running to linux - solution from CERN
On some Linux machines, FrameMaker is opening the license window and core dumping: FM is only running on 8 bpp on your screen but your configuration may be 16 or more. Here is a solution you can try on your Linux desktop: 1. Create a ~/.xinitrc file containing: #!/usr/local/bin/bash # # Sample ~/.xsession file PATH=$PATH:/usr/local/bin:/usr/local/bin/X11 export PATH ksh /usr/local/lib/hepix/X11/site/xclients& $FVWM2 -f ~/.hepix/wm/generated_fvwm2rc 2. Make it executable: chmod +x ~/.xinitrc 3. Launch a new graphic environment with 8 bpp: startx -bpp 8 -- :1 4. Check your environment and start FrameMaker If it does not work properly, contact linux.support, attach this page and ask them to modify the X server configuration so that 8, 16 and maybe more bpp are available at the same time.
Note that this is also solved by setting the depth to 24 so it's just 16 that seems to be problem...
Framemaker license allocation failing - use fmflsadm
"fmflsadm ping
" checks if the license server is running
"fmflsadm verify
" checks the running license server and will
clear any stale/expired license allocations
"fmflsadm -help
" for help...
Common substituion in multiple files... (bash)
for x in files ; do sed -e 'blah' $x > $$ ; mv $$ $x ; done
... or better:
perl -p -i -e 's/foo/bar/g;' files