An occasional outlet for my thoughts on life, technology, motorcycles, backpacking, kayaking, skydiving...

Wednesday, August 13, 2014

Seed your browser's autocomplete with important info

What do you do when you get that confirmation number after booking an airline ticket? Do you write it on a Post-It note? Lot of good that will do you when you are rushing to the airport. Do you just ignore it and trust that you got everything in an email? If your email is like mine, you may have a hard time finding it when you need it.

What you can do is copy the confirmation number "80085" and then navigate to the airline's website then add** the confirmation number as a query string Make sure that the query string is still there. Bookmark it and give it a helpful name like "Delta Flight" instead of the default "Delta Air Lines - Airline Tickets and Flights to Worldwide Destinations". Then, if you use an awesome browser like Google Chrome, your bookmarks will be synced across all of your devices. That way if you bookmarked this on your computer, when you type in "delta" on your phone you get...

Use the arrow on the right side to move the address to the address box rather than navigating straight there. Then you can select and copy just the confirmation number and have it ready to paste into the "Online Check In" form.

This is useful for lots of things. I use it for anything that I know I'm going to want to remember when I'm in a browser. I use Evernote, but not for this. I don't need the extra steps of going to the website on my phone, launch Evernote, find the note, copy the confirmation number, switch back to the browser, then paste.

**then add - I say this because sometimes the address you type. For example, gets redirected to a different address, like, and the query string may get lost. This is not the case with Delta, but it may be with others.

Thursday, February 27, 2014

Linux Oneliners

I am moving entries of my old one-liners text file to a web page for easier access.
# mount cdrom
[ -d "/mnt/cdrom" ] || mkdir -p /mnt/cdrom; mount /dev/cdrom /mnt/cdrom/

# mount a samba/cifs share (hostess is used by vmware in NAT mode)
user=rbronosky; [ -d "/mnt/smb" ] || mkdir -p /mnt/smb; mount -t cifs //hostess/$user -o username=$user /mnt/smb

# remove the leading path from a find
find . | sed 's/^..//'

# basic bash for-looping
for f in $(cat changed_files.txt) ;do vimdiff trunk/$f branches/iteration3/$f; done;
# if you have spaces in filenames
find . -type f |sed 's/^..//'|while read f; do ls "$f"; done
# or
(IFS=$'\n';for f in $(find . -type f) ; do cat ../Logs2/$f $f>../LogsCat/$f; done;)

# version number comparison using the power of the Python standard lib
[ "1" == "$(python -c "from distutils.version import *;print int(LooseVersion('3')>=LooseVersion('2.5.1'))")" ] \
&& echo Yes || echo No
# above is True, below is False...
[ "1" == "$(python -c "from distutils.version import *;print int(LooseVersion('2.3')>=LooseVersion('2.5.1'))")" ] \
&& echo Yes || echo No

# basic anonymous cvs
cvs -z3 ls

# make wget use filenames as suggested by the HTTP header Content-Disposition (requires wget>=1.11)
# becomes ps_color.vim
echo -e '\ncontent-disposition=on'>>~/.wgetrc

# copy files using ONLY ssh, not scp or sftp
tar cvf - $files_and_dirs_to_send | gzip | ssh $destination_server "cd $destination_dir; tar zxvf -"
# or to leave them compressed on the remote side...
tar cvf - $files_and_dirs_to_send | gzip | ssh $destination_server "cat > $destination_dir\archive.tar.gz"

### Help dad out via ssh (and telephone) ###
## I configure my router to forward $secret_port to port 22 on my machine.
## Because Ubuntu does not default to having and ssh server, I tell dad to do:
sudo apt-get install openssh-server
## I to tell dad to connect to my computer via:
ssh -p $secret_port -R $secret_port:localhost:22 -N $my_username@$my_router_ip & screen; kill %1
## I connect to his computer via:
ssh -v -p $secret_port $dad_username@localhost screen -x
## Now we are both looking at the same shell.  We can both type and collaborate.

## Convert/get a date from a timestamp using only Gnu Date
date -d @1199163600

## Sync the date of one server to that of another.  (Useful when firewalls prevent you from using NTP.)
sudo date -s  "$(ssh "date -u")"

## Get 255 random chars from /dev/random
uuencode -m - < /dev/random |sed 1d|tr -d \\n|head -c 255
# That is Base64 [/+a-zA-Z0-9], but you can add a substirution  to the sed.
# This one limits it to hex chars:
uuencode -m - < /dev/random |sed '1d;s/[^0-9A-F]//g'|tr -d \\n|head -c 255
# However, for storing into a DB, I like to keep the newlines so:
uuencode -m - < /dev/random |sed 1d|head -c 255

# Time stamp for a file name
date +%s
# a readable one
date +%Y%m%d%H%M%S

# Get ip addresses for all network interfaces
ifconfig | awk -e '/^[a-z]+/{sub(":",""); f=$1} /inet /{print f " " $2}'

# DiG format as a clean single line for batch processing

dig +nocmd +noall +answer