Tuesday, December 6, 2016

Bash Script Arugments

I write a lot of bash scripts. It's really out of laziness. Here is a script that allows parsing of specific arguments and passthrough of all other arguments. There are obviously many ways to do this but this is one of the ways that I've found to work best.

# Here is a boolean argument

# Here is an argument with a value

# Argument parsing.
for i in "$@"; do
  if [[ "$i" == ${ARG_NAME_1} ]]; then
  if [[ "$i" == ${ARG_NAME_2}* ]]; then
        ARG_VALUE_2 =${i:${#ARG_NAME_2}}

eval AppToLaunch $(IFS=$' '; echo "${ARGS[*]}")

Thursday, December 1, 2016

CAD for 3D Printing

I've been doing a lot of 3D printing with a Lulzbot Taz 5 lately and I've been working with lots of different CAD programs. I purchased ViaCAD and it's a pretty good program but it crashes once in a while and when it crashes, I loose the entire file, not just my work but the entire file! So I've been looking for an alternative. I run a Mac so I'd prefer to use something native to the platform rather than run a Windows VM. Here's a short list of the paid programs:

  • SolidWorks
  • Inventor
  • Rhino
  • Fusion360
  • Moment of Inspiration
  • SketchUp
  • Metasequoia
SolidWorks is by far the industry standard. If you pickup any product most likely it's been designed with SolidWorks. But it's expensive. Very expensive. Inventor is Auto Desk's version of solid works with about 20% of the market. It's good, but also expensive. Rhino is pretty darn good but they made a huge user interface change in the last few years making it terrible in my opinion. It isn't exactly inexpensive either. Fusion360 is a much less expensive cloud version of Inventor with less features and a monthly fee. Moment of Inspiration is $300. I actually rather like it but it is limited. On Mac it uses Wine which is less than ideal for a $300 piece of software in my opinion. SketchUp is both free and paid, but if you want to generate STL files you need the paid version. SketchUp is really good at architectural drawings but not good to non-geometric stuff. In order to get good prints from SketchUp you have to create your model really big and then scale it down. Even doing this you'll get funny odd jagged edges.

Now for the free stuff:
  • FreeCAD
  • LibreCAD
  • OpenSCAD
  • 123 Design
  • Antimony
  • TinkerCAD
Antimony has an interesting user interface. I'll keep my eye on it but it isn't usable. TinkerCAD is good for kids. LibreCAD and FreeCAD are powerful but extremely difficult to work with in my opinion. As it is I tend to build things in either 123 Design or OpenSCAD. I'll post more about 123 Design or OpenSCAD later.

Wednesday, November 30, 2016

Holloween 2016 - Harry Potter

In Halloween tradition we did another Halloween trick-or-treat garage. I did an mini Maker's Fair showing off the stuff that I build. I 3D Printed over 200 LED candles and suspended them over my driveway. I made a wand that actually did stuff although this video doesn't show it. I have a self stirring spoon, moving pictures, walls that look like stained glass, Dumbledoor's Chair and lots and lots of other small details. Leave a note in the comments if you have any questions or cool Harry Potter projects you want to share or just want to ask how I did something. If I get time I'll post some how to's but let me know if you're interested so I know what to focus on.

Tuesday, October 18, 2016

Review: Dell Ultra HD 4k Monitor P2715Q 27-Inch Screen LED-Lit Monitor

I've been looking for a second monitor for some time now. I currently run an Apple 30" Cinema Display, which is awesome by the way. Between the Missus and myself we have three of them. They are heavy however and not super energy efficient. The Dell P2715Q  came down to $450 on Amazon last December (10 months ago) so I picked one up. You can find other in depth reviews of the monitor around the web, here's one for example P2715q review, because I want to say some bad things about this monitor.

Overall the monitor isn't bad. It is light, it is considerably smaller than 30" monitor, the stand is OK and the monitor holds it's tilt angle better than some monitors. The controls are standard Dell controls. The resolution is amazing! 4K is really nice, if your computer can drive it. Make sure it can drive it because one of my older Mac Books is old and the interpolated resolution leaves a lot to be desired. The Display Port sucks. They have a bad display port chipset in it and it won't wake the Mac at times.

But now I have to get to my scathing review. It died after owning it for 10 months. Honestly, I hardly used it. I believe the power supply went belly up. It is under warranty so I called Dell. I won't bother going into details, but I can say based off my overall experience I suggest looking elsewhere for computer hardware. I will never buy another Dell monitor or computer again. I'm currently on the phone trying to figure out why they sent me an email saying they were going to call me over 2 hours ago and to wait around for that call for 2 hours. They have no idea. It's been over a week now since my initial call and they plan to send me a refurbished unit as a replacement but they have to verify my purchase. Apparently that will be a little while longer. On the plus side the person I spoke with today was very nice. Anyway, I said I wouldn't go into details but I think all that's worthwhile.

So, in summary, I like the monitor, looks great, functions good, it's a good monitor, but don't buy one because it will die and you'll send a week of your life trying to get a replacement.

Monday, August 22, 2016

iOS Looses Your Calendar

I've now seen three devices loose the entire Calendar. All events are gone, all calendars are gone. It doesn't make any sense. You can tell if this is the case by going to Settings | iCloud | Scroll down find find Default Calendar. If it isn't there then you have run into this problem. The only work around that I know of is you sign out of your iCloud account and sign back in. Remember all of your settings. Best to take a screen capture of all the screens so you can recreate what you had.

Tuesday, July 19, 2016

Create a Rounded Cube in OpenSCAD

There are two ways to easily make a rounded cube. The first is to use the hull function:

module RoundedCube(size, radius) {
    width = size[0];
    height = size[1];
    depth = size[2];
    hull() {
        translate([radius, radius, 0]) cylinder(r = radius, h = depth);
        translate([width - radius, radius, 0]) cylinder(r = radius, h = depth);
        translate([radius, height - radius, 0]) cylinder(r = radius, h = depth);
        translate([width - radius, height - radius, 0]) cylinder(r = radius, h = depth);

The second is to use linear_extrude and the offset functions:

module RoundedCube(size, radius) {
    width = size[0];
    height = size[1];
    depth = size[2];

    translate([radius, radius, 0]) linear_extrude(height = depth) offset(r = radius) square([width, height]);

Now they aren't exactly identical. They will produce slightly different rounded cubes, but hopefully this helps someone out there use OpenSCAD.

Monday, July 18, 2016

Photographing People

A while back I ran into Joe Edelman YouTube channel. If you want to photograph people and use flash this is a very good channel. Specifically I suggest checking out One Light Portrait Lighting for AWESOME Portraits & Headshots.

Wednesday, July 13, 2016

Remove Every Other Line in a Text File

Once in a while a while you need to remove every other line in a text file. It's really easy to do with awk from the Terminal:

awk 'NR % 2 == 0' infile > outfile

There are obviously a lot of ways to accomplish this simple task but this is by far the easiest.

Monday, June 20, 2016

Copy a DVD/CD on a Mac

Recently I had to walk a friend over the phone how to make a copy of a DVD, so I wrote down the directions as I went and here they are since the ones I found on the internet were always missing a step. Making a Disk Image of the DVD/CD 1. Run Disk Utility 2. Insert “YourDisk” DVD into DVD drive 3. It’ll show up on the left hand list as: SuperDrive YourDisk 4. Left click on “YourDisk” to select it. 5. Click the “New Image” button at the top in the toolbar. 6. “Save As” will be set to “YourDisk.dmg”. This will change with step 8. 7. On the left hand side choose where you want to save it to. I selected the Desktop. 8. At the bottom “Image Format” is set to “compressed”, change this to “DVD/CD master”. This will change “ YourDisk.dmg” to “YourDisk.cdr”. 9. Make sure “Encryption” is set to “none”. 10. Click Save. 11. This will take a while. 12. Once it’s done, go to the next step. Burning the DVD 13. Eject the “YourDisk” DVD and insert a blank DVD. 14. In Disk Utility, at the bottom of the list on the left hand side you will see “YourDisk.cdr”. Select “YourDisk.cdr” and click the “Burn” button at in the toolbar at the top. Just follow the directions...

Tuesday, April 26, 2016

Setting Master/Slave on the Canon 580EXII

I always forget how to do this so I'm blogging about it so I know right where to look and so maybe it helps one other person. 1. Press and hold zoom for about 3 seconds to get into the master/slave mode. 2. Rotate the wheel to select between "off", "master on" or "slave on". 3. Press the set button. Don't forget the set button. Happy multiple flash photography!

Thursday, April 21, 2016

Lulzbot Taz 5

I got one. I decided to not wait for the Taz 6 for two reasons. It's about 6 months out and a friend has a Taz 5 so we can make tweaks together and support one another. And I have some stuff I wanted to print. Plus Lulzbot, and the community, supports their old printers so well I don't think it'll be out of date any time soon. Some recommendations for first time owners of a 3D printer and specifically a Taz 5. 1. Throw away the knife tool and buy a paint spatula like this: I bought a Liquitex free style. It was about $12 at the local art supply store. The key things you are looking for is the angle holding the spatula part so you can get the spatula flat on the bed without your hand interfering. You also want it to be fairly sharp but strong. This one has variable thicknesses for each protrusion on the spatula. 2. I changed the factory settings on the printer. The factory settings are: Vmax-x: 800 Vmax-y: 800 Vmax-z: 8 Amax-x: 9000 Amax-y: 9000 Amax-e: 10000 Aretract: 3000 I changed these to the following: Configuration->Advanced Vmax-x: 192 Vmax-y: 208 Vmax-z: 3 Amax-x: 2000 Amax-y: 2000 Amax-e: 400 Aretract: 2000 Make sure to store the settings. -> Store Settings 3. The Cura settings change depending on the filament. I've been having great experience with Verbatim 3mm filament using the following settings: Basic: Layer height: .15 Shell thickness: 1 Enable retraction: true Bottom/Top thickness: 1 Fill Density %: 20 Perimeters before Infill: true Print speed: 60 Printing temperature: 0 Bed temperature: 0 Diamter: 2.85 Flow: 100 Advanced: Nozzle size: .5 Speed: 10 Distance: 4 Initial layer thickness: .15 Initial layer line width: 100 Cut off object bottom: 0.0 Travel speed: 100 Bottom layer speed: 30 Infill speed: 75 Top/bottom speed: 40 Outer shell speed: 40 Inner shell speed: 60 Minimal layer time: 5 Enable cooling fan: true The reason I set the temperatures to zero is I turn them on on the printer itself first. This allows gcode to print PLA or ABS. However, the other settings need to match as well. This doesn't work when switching between other brands of filaments that need different settings. For instance IC3D filament is 2.9mm rather than the standard 3mm filament of 2.85 (yeah, that doesn't make sense). However, IC3D filament has been impossible to print with. I had an impossible time on the Type A Machine Series 1 as well. Same problems actually. IC3D filament requires 115 degrees and a slightly hotter bed of 70 degrees, while Verbatim is 105/60. But the IC3D is so chalky if there is any retraction the filament stepper eats through the filament resulting in a failed print. Verbatim is a little more difficult to get though since Amazon won't ship it to me. It's an Amazon bug that we've been going back and forth on for some time. eSun is also good filament. A bit more stringy though.

Tuesday, March 15, 2016

Bash Script to get Path to Inself

I use bash enough and fumble my way through it that I have little nuggets like this but I never retain them in my brain. So, in contributing to the global bash community and my external brain storage, here is how to get the path that your currently running script lives in.

PATH=$(cd $(dirname $0) ; pwd -P)
And since people typically post scripts like this, even one liners, and don't explain them, I'll explain each piece. 1. The first argument is the full file name to the script: $0 2. Get the directory of the script. You'd think we'd stop there, but we keep going: $(dirname $0) 3. Change directories to the directory containing the script: cd $(dirname $0) 4. Run another bash command: ; 5. Get the current working directory, and -P resolves symlinks: pwd -P 6. Assign the directory containing the script and that is not a symlink so the real path to the PATH variable: PATH=$(cd $(dirname $0) ; pwd -P) There you have it!