krypted.com

Tiny Deathstars of Foulness

The caffeinate command is pretty cool. It keeps your computer from going to sleep. It can run in a couple of different ways. There’s a timer that prevents sleep for a little while. You can also run another command from within caffeinate that keeps the system awake until the other command is finished. Here, we’ll scp a file called source file to a host called servername and keep the system from going to sleep until the process is finished:

caffeinate -s scp sourcefile me:servername/targetfile

Here, we’ll just use the boring command to tell the computer not to go to sleep for an hour:

caffeinate -t 3600 &

July 24th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security

Tags: , , , , ,

Leave a Comment

July 24th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, personal

Leave a Comment

The at command can be used to schedule jobs to be run at certain times. I have a hard time getting up in the morning. Here, we’re going to echo a command that we want to be run at a certain time. In this case, we’re going to open a song to make into our alarm clock:

echo 'open ~/Desktop/bangbang.m4v 2>/dev/null' | at 07:00 tomorrow

The job will then output. You can see jobs waiting to be run, along with when they’ll be run using the at command with the -l option:

at -l

In this case, the job is 2. You can then remove a job using the atrm command:

atrm job 2

July 23rd, 2015

Posted In: Mac OS X, Ubuntu, Unix

Leave a Comment

By default in OS X, when you change an extension for a file, you get a warning. This is somewhat annoying to me, as I do this pretty frequently and have never almost accidentally done so. So to disable, send a FXEnable ExtensionChangeWarning key into com.apple.finder as false:

defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

To then undo, simply run with a true key:

defaults write com.apple.finder FXEnableExtensionChangeWarning -bool true

July 22nd, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security

Tags: , , , ,

One Comment

One of the great things about cat is that you can view the contents of a file with line numbers. You do so using the -n option, as follows:

cat -n ~/Desktop/myFile

Sometimes a file is too big to view though, so you can pipe the output to less, to combine some of the best features of each:

cat -n ~/Desktop/myFile | less

Obviously, the same thing would work with more:

cat -n ~/Desktop/myFile | less

You can also do something similar with the grep command and the -n option:

grep -n ^ ~/Desktop/myFile | less

Enjoy.

July 21st, 2015

Posted In: Mac OS X, Ubuntu, Unix

Tags: , , ,

One Comment

The cd command has lots of fun little shortcuts. One I use frequently is the -. The ~ always takes you to your home directory, but using cd – will take you to the last directory you were in. For example, if you do the following on a Mac:

cd ~

Then you do .. (which is a shortcut for the directory above the one you’re in):

cd ..

Then pwd will show that you’re in /Users. But, if you cd to – again:

cd -

Now you’re back in your home folder. The – expands to OLDPWD. Quick tip. Nothing more to see here.

July 20th, 2015

Posted In: Mac OS X, Ubuntu, Unix

Tags: , , , , ,

One Comment

July 20th, 2015

Posted In: personal

Leave a Comment

As of OS X 10.9 (and in many cases more importantly in OS X Server for 10.9 and higher), OS X now performs ARP cache validation when trying to pass traffic over a router. If you are double NAT’d/use redundant gateways then the traffic can be interpreted as network redirection and cause some pretty bad packet loss/latency. You can disable this feature by turning off net.link.ether.net.arp_unicast_lim using sysctl:

sysctl -w net.link.ether.inet.arp_unicast_lim=0

That will only disable unicast arp validation until the next reboot. If it fixes a latency problem you’re having then you can go ahead and make it permanent by adding the following line into /etc/sysctl.conf:

net.link.ether.inet.arp_unicast_lim=0

If you’re still having issues with latency, you should turn it back on. To enable it again, repeat, swapping the 0 with a 1.

July 19th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, Mass Deployment

Tags: , , , , , , ,

Leave a Comment

July 18th, 2015

Posted In: Unix

Leave a Comment

So a few months ago, closing in on 3,000 posts, the database got too big and krypted.com started suffering from innodb corruption, resulting in database outages. While I was able to get the site up, it was using a read-only database that kept me from doing any new articles or updates. It was a strange time in my life, like suddenly being single after living with someone since Y2K (when I started the site). But I got through it and was able to repair the relation… er, site. Now, with a new database that is free from corruption we’re ready to get to 6,000 posts!

Also, I had a little feedback on the usability of the site. I had thought people would scroll down to find the search box. Apparently there’s a reason most sites put it at the top. It’s now there here. I also made a couple of new pages (in addition to the articles I’ve been posting since it came back up) and removed a couple of pages. Most of the pages have gotten fresh information and had at least something retired. No changes to articles in all of this, just pages.

Finally, I know I’ve made this offer in the past, but I welcome any guest authors that would love a place to store their stuff. Talk about anything technical you’d like, from Arduino to BRU to Casper to Munki to OpenMDM to Linux to PowerShell. It should just be technical…

July 17th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, Mass Deployment

Tags:

One Comment

« Previous PageNext Page »