Posts

Selecting a random member of a bash array

I came across this little tidbit today, I wish I hadn't closed my browser so I could give adequate credit but here is how to select a random port out of an array of ports in bash: DEST_PORTS=(22229 31457 42853) function pickDestPort () {   RANDOM=$$$(date +%s)   selectedport=${DEST_PORTS[$RANDOM % ${#DEST_PORTS[@]} ]}   echo $selectedport }

The highest volume spammer domains for me at work

Spammers who regularly hit me at work in alphabetical order: bazigarserver.biz cudaops.com electric-cloud.com itpracticetrg.net mcdlv.net nakivo.us netuitive.com platform9.com pmpcerttraining.org pmprofessionaltraining.org professionalpmpcoursetrainings.org projmgmtproftrainings.org projmgmttrainingprogram.biz seemailserver.org threatstack.com trello.com trgcertproject.net

VirtualGL on Fedora 21

It isn't generating the key so the xauth merge fails This link fixes paths, and I think might be relevant for my problem https://github.com/chenxiaolong/Fedora-SRPMS/blob/master/VirtualGL/fix-paths-in-vglgenkey.patch diff -Nru VirtualGL-2.3.orig/server/vglgenkey VirtualGL-2.3/server/vglgenkey --- VirtualGL-2.3.orig/server/vglgenkey 2012-02-25 00:12:07.913553458 -0500 +++ VirtualGL-2.3/server/vglgenkey 2012-02-25 00:23:01.450462350 -0500 @@ -1,17 +1,14 @@ #!/bin/sh XAUTH=xauth -if [ -x /usr/X11R6/bin/xauth ]; then - XAUTH=/usr/X11R6/bin/xauth +if [ -x /usr/bin/xauth ]; then + XAUTH=/usr/bin/xauth fi -if [ -x /usr/openwin/bin/xauth ]; then - XAUTH=/usr/openwin/bin/xauth +if [ ! -d /etc/VirtualGL ]; then + mkdir -p /etc/VirtualGL fi -if [ ! -d /etc/opt/VirtualGL ]; then - mkdir -p /etc/opt/VirtualGL +if [ -f /etc/VirtualGL/vgl_xauth_key ]; then + rm /etc/VirtualGL/vgl_xauth_key fi -if [ -f /etc/opt/VirtualGL/vgl_xauth_key ]; then - rm /etc/opt/VirtualGL/vgl_xauth_key -fi -...

Enable ssh tunnel to home via systemd

# vi /usr/local/bin/vpntohome.sh     #!/bin/bash     su - vpntohome -c "screen -D -m /home/vpntohome/vpntohome" # chmod 700 /usr/local/bin/vpntohome.sh # vi /lib/systemd/system/vpntohome.service     [Unit]     Description=Start SSH tunnel to applesauce     After=syslog.target network.target sshd.service     [Service]     Type=simple     ExecStart=/usr/local/bin/vpntohome.sh     RestartSec=120     [Install]     WantedBy=multi-user.target # cd /etc/systemd/system/ # ln -s /lib/systemd/system/vpntohome.service vpntohome.service # systemctl daemon-reload # systemctl start vpntohome.service # systemctl enable vpntohome.service

Backups with gpg encryption

# As root gpg --gen-key gpg --export-secret-keys --armor root@host.example.com > root-privkey.asc # copy root-privkey.asc to a safe place non-online place # export the public key for encrypting and signing gpg --export --armor root@host.example.com > /tmp/root-pubkey.asc # import the key into the backup creator's key ring gpg --import  /tmp/root-pubkey.asc gpg --edit-key root@host.example.com ## sign it ## trust it ultimately # modify the backup script to pipe through gpg gtar --totals --bzip2 --create --exclude=Favicons ..... | gpg --encrypt --recipient root@host.example.com > real.backup.filename.here.bz2.gpg

Create a custom tool for p4v to spawn Rubymine on a directory straight out of p4v

Create a new script: mkdir -p ~/bin/generic/run-rubymine-as-a-tool.sh vim ~/bin/generic/run-rubymine-as-a-tool.sh #!/bin/bash if echo "${1}" | grep -q '...$'; then   DIR="`dirname ${1}`" else   DIR=${1} fi exec ${HOME}/bin/RubyMine/bin/rubymine.sh "${DIR}" chmod 0754  ~/bin/generic/run-rubymine-as-a-tool.sh Under p4v: Tools -> Manage Custom Tools -> New Tool Name: Rubymine Select: Add to application context menus Application: ~/bin/generic/run-rubymine-as-a-tool.sh Arguments: %d

Fedora 21 ntpd restart problems after boot

This seems to finally have got it working across boots sudoedit /usr/lib/systemd/system/ntpd.service [Unit] Description=Network Time Service After=syslog.target ntpdate.service sntp.service multi-user.target network.target sshd.service Conflicts=systemd-timesyncd.service [Service] Type=forking EnvironmentFile=-/etc/sysconfig/ntpd ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS PrivateTmp=true [Install] #WantedBy=multi-user.target WantedBy=default.target sudoedit /etc/systemd/system/ntpd.service.d/restart.conf [Service] Restart=always RestartSec=17 sudo systemctl daemon-reload sudo systemctl restart ntpd.service Update: still a problem finally googled right, it is %#(%^&(#^ service called chrony.