tech drops

RSS

Jude Robinson : The single most useful thing in bash

I knew about `set show-all-if-ambiguous on`, but the rest really bring some magic to the good ol’ Bash.

Apr 5

Possible solution for OS X Mountain Lion SMB connection and disappearing WINS workgroup problems

I hope this works for you, if you bump into smb problems where the WINS workgroup and NetBIOS name are reset or disappear at reboot.

Apr 2
I fell in love with Keka, an extremely well made OS X app for compressing archives. It made me switch to 7z as my favorite and default format. Results are impressive (see picture to compare a file sizes).
Because of the way it’s designed and configurable, it now sits in my Dock and awaits for stuff to be dropped on it, knowing it will do the job right. If I need anything out of the ordinary, I’ll just launch it, and just drop whatever stuff there, after choosing the different format.
It got some fine details right, like the ability to automatically exclude resource forks (.DS_Store) files automatically.

I fell in love with Keka, an extremely well made OS X app for compressing archives. It made me switch to 7z as my favorite and default format. Results are impressive (see picture to compare a file sizes).

Because of the way it’s designed and configurable, it now sits in my Dock and awaits for stuff to be dropped on it, knowing it will do the job right. If I need anything out of the ordinary, I’ll just launch it, and just drop whatever stuff there, after choosing the different format.

It got some fine details right, like the ability to automatically exclude resource forks (.DS_Store) files automatically.

Mar 5

Downloading online videos made (hacker-)friendly

This is my favorite way to download YouTube videos (or Vimeo and much more). Here is the initial setup:

  1. Install `youtube-dl` (via homebrew for OS X)
  2. Set up bash aliases such as these:

alias yt1080="youtube-dl -f 37/46 -o '[%(uploader)s] %(title)s.%(ext)s' $1"
alias yt720="youtube-dl -f 22/45 -o '[%(uploader)s] %(title)s.%(ext)s' $1"
alias yt480="youtube-dl -f 44/35/18 -o '[%(uploader)s] %(title)s.%(ext)s' $1"
alias yt360="youtube-dl -f 18/43/34 -o '[%(uploader)s] %(title)s.%(ext)s' $1"

Now whenever you want to download a video, just type yt1080, yt720, yt480 or yt360 (depending on the desired quality) followed by the url of the video (or just video id) to start downloading the video with a nicely formatted filename. The script will select the mp4 version first, falling back to webm or flv, respectively. Example:

$ yt720 fdJc1_IBKJA
[youtube] Setting language
[youtube] fdJc1_IBKJA: Downloading video webpage
[youtube] fdJc1_IBKJA: Downloading video info webpage [youtube] fdJc1_IBKJA: Extracting video information
[download] Destination: [devinsupertramp] World's Most Insane Rope Swing Ever!!! - Canyon Cliff Jump.mp4
[download] 4.0% of 82.25M at 658.52k/s ETA 02:02

Oct 7

How to setup mcrypt for php in OS X

With Homebrew, it’s very easy. Given that you tapped in with Jose Gonzalez’s php repo.

1. Install mcrypt and it’s libraries by typing: brew install mcrypt php53-mcrypt

2. add the content of /usr/local/etc/php/5.3/conf.d/ext-mcrypt.ini to /etc/php.ini

3. restart Apache ( sudo apachectl restart )

Quick tip: Empty a file’s contents with the Terminal

> filename

In other words: dump whatever is in front of the “>” sign (nothing) into the specified file.
Comes in handy for flushing files, while keeping permissions.
For a while I was doing rm+touch+chmod, until I found out about this.

Error #1062 - A (somewhat) curious MySQL situation

When I was importing a bunch of records from CSVs into a MySQL database, at some point I ran into an intriguing issue. Totally legit, but still strange in the way it shows up:

#1062 - Duplicate entry '127' for key 'PRIMARY'

How can the AUTO_INCREMENT’ed primary key be duplicated?
My table is pretty straightforward: some varchars, some ints, a couple of dates.

The important detail here is the primary key, the typical id that is generally the first field. Turns out, for some reason I set it as tinyint(4) when I created the table, thinking it would be enough, being the table not supposed to be big. As this table shows, the maximum value for signed tinyint is 127, just like the error message reported. When MySQL tries to increase that value, the field is capped to 127 and it reports the duplication issue.

The solution is to simply set it a bigger cap value. A int will work fine for now.

Jun 7
randomyesusefulno:

Helpful tennis ball

randomyesusefulno:

Helpful tennis ball

Avería – The Average Font

In the end, I decided to release the font using the SIL Open Font License – which means anyone can use it pretty much however they like – and to include within the family Regular, Bold and Light variants with Italics.

I personally find it to be very good for movie subtitles (and so I set it up in VLC).

(Source: bigweek.co)

Woz on Mac OS price.

From Letters of Note: Apple must make Macintosh a standard:

Apple co-founder Steve Wozniak has since said:
“The computer was never the problem. The company’s strategy was. Apple saw itself as a hardware company; in order to protect our hardware profits, we didn’t license our operating system. We had the most beautiful operating system, but to get it you had to buy our hardware at twice the price. That was a mistake. What we should have done was calculate an appropriate price to license the operating system. We were also naive to think that the best technology would prevail. It often doesn’t.”

Since I believe this is still true (maybe not in the numbers of multitude as back then) it feels like Woz agrees with me.