New project on Github to run a bash script when a user clicks on a button. This is pretty basic, easily customizable, lots of stuff you could add, and with a license I’m sure anyone can appreciate. Hope you enjoy.
Rarely, but Happily!
In bash, you can run multiple commands in a single line of a script. You do so by separating them with a semi-colon (;). The great thing about this is that if you end up using a variable, you can pass it on to subsequent commands. Here, we’re going to string three commands together and then echo the output:
a=1;b=2;c=$a+$b;echo $cbecause we told c to be $a + $b, the $a expands to 1 and the $b expands to 2, we throw them together and then echo out the contents of c$ which appears as follows:
1+2Now, we could have this thing do math as well, by wrapping the mathematical operation in double-parenthesis, which bash treats as an arithmetic expansion:
a=1;b=2;c=(($a+$b));echo $cThe output this one is simply 3.
When you accidentally paste a code block in the wrong place…
You waited. And you tapped your fingers on the desk. And you sat and waited some more, for the UPS person. You stared at your mailbox. And then, after all of that, UPS showed up. And you signed. And then you had that box in your hands. The cardboard box, when opened, gave way to a sweet white box. You opened it by pulling the little tag off, and then you pulled the watch out of the box. You tried on the two bands. And you picked the one that fit you the best. So now what? Turn on the watch by hitting the button on the side and watch that beautiful Apple logo light up the screen. But now you need to pair the watch with your phone for it to be useable. So what to do? Well, first of all, make sure your phone is updated to the latest and greatest version of iOS. From there, open the Apple Watch app on the iPhone. The app will prompt you to start pairing a watch with the phone. You can only pair one watch with an iPhone. Tap the Start Pairing button. When prompted, line up the screen on the watch with the image and the outline. Wait for the watch to complete pairing and then tap the Set Up Apple Watch button. You’ll then be prompted for which wrist to put the watch on. I used my dominant wrist, so right. You’ll then be prompted to accept the Terms and Conditions (aka license agreement) from Apple. Tap Agree. Tap Agree again. Next, when prompted for the Apple ID to use, if you’d like to use an Apple ID with the watch, provide the password for that Apple ID using the Enter Password button, or use the Skip This Step option to skip the Apple ID. At the Location Services screen, tap OK. This is really just informational to let you know that Location Services will be used. It’s kinda’ necessary to use the watch properly. At the Siri screen, again, you’re informed that Siri will be used. Tap OK. At the Diagnostics screen, same thing. You’re informed that diagnostics will be supplied to Apple. Tap OK. At the Apple Watch Passcode screen, choose whether you’d like to use a passcode on the watch. I’m not a fan of using a passcode on the watch; however, you will have to use one if you want to use Apple Pay on the watch. Tap Create a Passcode to set one up now and then provide the passcode you’d like to use. The Apple Watch will sync apps and show glances from apps that are on the phone. Tap Install All to go ahead and install any Apple Watch apps on the device. You can always turn them off later. Or you can tap Choose Later to go ahead and complete setup and wait until later to set up the watch and finish apps setup later. I’d recommend using Install All and then turn off the ones you don’t want later. Then the watch will start syncing with your devices. At the Apple Watch Is Syncing screen, wait. Don’t do anything else or get the watch too far from the phone or you’ll have to start over from scratch. The watch looks like this while it’s syncing. Once the watch is finished syncing, use the My Watch app to sync apps, show glances, setup Apple Pay and configure which built-in apps are shown on the device. The next and most important aspect of your new Apple Watch is to use it and love it. Go for a run, sync some apps, enjoy the hell out of your new watch. It’s great. Now, get to it!
The other day, my daughter said “it’s opposite day” when it was time to do a little homework, trying to get out of it! Which reminded me of a funny little command line tool called rev. Rev reads a file and reverses all the lines. So let’s touch a file called rev ~/Desktop/revtest and then populate it with the following lines:
123 321 123Now run rev followed by the file name:
rev ~/Desktop/revtestNow cat it:
cat !$Now rev it again:
rev !$You go go forward and back at will for fun, much more fun than homework… Enjoy!
I’ve spent way too much time traveling in my life (and way too little time writing about non-technical things). It’s had ups and it’s had downs. But these days, a bunch of fun little technical breakthroughs that make traveling incrementally better. And one of those things is Uber (and other similar services) who have disrupted the short-range ground transportation game. And I like them so much, I decided to write a little list of the reasons why! While writing, I also realized that you can use this code and we both get Uber credit I never used a promo code. But you can: https://www.uber.com/invite/uberkrypted. Has nothing to do with why I wrote this, but it’s a nice thing for me to find while writing… So here’s my top 10 reason Uber rocks:
- I believe in the model. People work when they want and seem generally happy. I’ve had a lot of students and people who drive a little after their day job just here and there whenever they feel like it. And they love it. It’s transparent. Everyone is wide open when it comes to talking about what they do and how the process works. Even in the apps, it’s all very transparent. The app requires the credit card, but you never have to give the card to the driver. You can text the driver (e.g. if you accidentally drag the pin a little when you’re a bit buzzed to let them know where to get you).
- The reason the model and the transparency are possible is that the tech is great. I can see a map of all the cars, the route they’re going to take, the exact(ish) number of minutes before they show up and the payment is all kinds of working for me. In fact, the tech is so great that I reference their interface here and there in UX meetings. For example, how that whole awesome credit card entry screen works (if you haven’t seen it, it should be the design everyone uses forever cause it’s that rad). But my credit card never goes in their hands. The maps are great and up-to-date and the app is bad daddy, sleek and probably should earn their UX team some awards (not awards like getting knighted but awards like getting a trophy or something). They email receipts, so I don’t have to cart around printed receipts to do an expense report. They have a web lost and found.
- It’s been faster than getting a cab every single freakin’ time! For some areas it’s like half an hour faster. Boom. And I don’t have to setup an appointment the night before with some craptastic Danny DeVito-style operator who still needs me to read out an address and then have that cab show up 15 minutes late when I’m in a hurry or 15 minutes early when I’m still in the shower and start calling over and over. I can see where the car is on a map. Love that. And if you tell a driver a better route, they actually listen…
- It’s not possible to tip in the app. Or not that I’ve found. I do still throw a few bucks their way here and there when I actually have cash because they’re awesome. But when I’ve not had cash it’s a no harm no foul kind of situation. They don’t expect it and they’re great people so usually deserve something more than $15 or whatever for the amount of time I spend with them…
- You rate the drivers. I have given all of mine 5 stars. And they can rate me. And they’ve all given me 5 stars. It’s not possible my experiences will absolutely always be this awesome (YMMV I’m guessing) but it’s definitely been a great run.
- Cab drivers are rushing around and rude drivers. Nothing harshes my calm more than feeling like I get some negative karma points for someone else hurling their car around like a vehicular version of the Jerky Boys.
- Credit cards. In the past year or two, at least half the time I’ve taken a cab, the driver gets annoyed if I can’t tip in cash, or sometimes pay in cash. I shared a cab with my friend Zack (@acidprime) once and since we were paying with credit cards the driver wouldn’t even charge us at all. Totally annoying… This does seem to be getting better with the cabs that have the video screens in the back. But I’d almost rather them get annoyed than having some of the early versions of those things screaming at me while I’m trying to talk during a conference call…
- The drivers are quirky and interesting. I have had a great run with this. I did have a funny little moment with this recently where a lady driver was telling me about her grandkids, which I thought was natural, but then she started telling me all about the “arrangement” she has with her husband and referencing knocking off early and hitting my hotel bar. Alright, it was fun to get hit on by my first Uber driver, even if she was 20 years older than me! The one on the way back to my hotel later that night was telling me all about his Tinder whoreness. Hilarious conversationing! Also, they all know how it works. I tried to get in the wrong Uber the other day and even though the guy got stood up he was like “no thanks.” I’ve had cab drivers from the same company pick me up and not radio it in and then I get nasty calls from dispatch when I thought I was getting in the right cab ’cause they lied about it! Teh lamer…
- Oh, and did I mention that Uber is cheaper than a cab. I once got a little too tipsy to drive and took a cab from the Los Angeles Airport (LAX) up to Hollywood. It cost over $100. I took an Uber to Sunset and started further away than LAX and it was $41. .
- Because it’s so much cheaper than a cab, there’s even less of a reason to get a DUI too. It seems like I see less drunk drivers later at night since it became a thing, too. So for the final one: Uber saves babies and makes the world a safer place.
Any time doing a migration of data from one IP to another where that data has a DNS record that points users towards the data, we need to keep the amount of time it takes to repoint the record to a minimum. To see the TTL of a given record, let’s run dig using +trace, +nocmd to turn off showing the version and query options, +noall to turn off display flags, +answer to still show the answer section of my reponse and most importantly for these purposes +ttlid to toggle showing the TTL on. Here, we’ll use these to lookup the TTL for the www.krypted.com A record:
dig +trace +nocmd +noall +answer +ttlid a www.krypted.comThe output follows the CNAME (as many a www record happen to be) to the A record and shows the TTL value (3600) for each:
www.krypted.com. 3600 IN CNAME krypted.com. krypted.com. 3600 IN A 220.127.116.11We can also lookup the MX using the same structure, just swapping out the a for an MX and the FQDN with just the domain name itself:
dig +trace +nocmd +noall +answer +ttlid mx krypted.comThe response is a similar output where
krypted.com. 3600 IN MX 0 smtp.secureserver.net. krypted.com. 3600 IN MX 10 mailstore1.secureserver.net.