Check These Out
Displays the duplicated lines in a file and their occuring frequency.
Example :
$ vim /etc/fstab
## damn
$
$ sudo
## like a boss.
Example 2 :
$ sudo vim /root/bin/
##uh... autocomplete doesn't work...
$
$ sudo ls /root/bin
##ah! that's the name of the file!
$ sudo vim /root/bin/ ##resume here! Thanks readline!
zsh only
If you have this command in your history, you can always re-run it and have it reference the latest file.
The glob matches all timestamped files and then the resulting array is sorted by modification time (m) and then the first element in the sorted array is chosen (the latest)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Print out your age in days in binary.
Today's my binary birthday, I'm 2^14 days old :-)
.
This command does bash arithmatic $(( )) on two dates:
Today: $(date +%s)
Date of birth: $(date +%s -d YYYY-MM-DD)
The dates are expressed as the number of seconds since the Unix epoch (Jan 1970),
so we devide the difference by 86400 (seconds per day).
.
Finally we pipe "obase=2; DAYS-OLD" into bc to convert to binary.
(obase == output base)
if you, like me, do not have the numsum, this way can do the same.
In this case the current user has proxy variable set which allows access to the rpm on the internet but needs root privs to install it.
Running sudo -E preserves the current user proxy var and allows the rpm install to be executed with sudo.
curl inet-ip.info -> 113.33.232.62\n
curl inet-ip.info/ip -> 113.33.232.62
curl inet-ip.info/json -> JSON print
curl inet-ip.info/json/indent -> JSON pretty print
curl inet-ip.info/yaml -> YAML format
curl inet-ip.info/toml -> TOML format
http://inet-ip.info
The command renames all files in a certain directory. Renaming them to their date of creation using EXIF. If you're working with JPG that contains EXIF data (ie. from digital camera), then you can use following to get the creation date instead of stat.
* Since not every file has exif data, we want to check that dst is valid before doing the rest of commands.
* The output from exif has a space, which is a PITA for filenames. Use sed to replace with '-'.
* Note that I use 'echo' before the mv to test out my scripts. When you're confident that it's doing the right thing, then you can remove the 'echo'... you don't want to end up like the guy that got all the files blown away.
Credits: http://stackoverflow.com/questions/4710753/rename-files-according-to-date-created