TheShed

Mac OS Tools

Category: Tools
#Mac OS

Some Mac OS X stuff…

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

To install Homebrew. You might argue that downloading and executing arbitrary ruby scripts is a tad dangerous. But then so is downloading and executing some bin. (With scripts you have the benefit of being able to examine the source before you download, but watch out for a bait-and-switch if someone decides to show your browser different content because they detected a specific user-agent.)

Now let's grab wget:

brew install wget

You see, just like apt-get (or Chocolatey).

Now we'll use wget to grab stuff from a NAS:

wget -m ftp://usr:pass@server/path/to/files

(Why aren't we using SMB? That's a long story but essentially it's an old NAS and a recent Mac OS X build.)

If I don't want to include the source directory structure in the target add --cut-dirs=4 where 4 is the sum of the number of directories specified in the path +1 (for the server name).

Memory Testing

Category: Tools
#system #OS #memory #test

memtest does what it says on the tin. It tests memory. Grab the installer from http://www.memtest.org/#downiso and install onto a bootable USB.

On a recent machine you'll need to disable UFEI in the BIOS to boot from the USB stick.

Powershell JumpLocation

Category: Tools
#PowerShell

A PowerShell script that remembers where you've been and makes it really easy to Jump there → https://github.com/tkellogg/Jump-Location

Serving content during development

Category: Tools
#pelican #HTTP #tools #python #web

Python's SimpleHTTPServer is my goto friend for serving HTTP requests locally while developing stuff. Sometimes however you get caught with the browser caching things that you really don't want it to. CTRL+F5 usually works (it's a hardcoded pattern for me by now) but today I stumbled on a gotcha: cached JSON content that a page was pulling in.

The solution for me, was to modify SimpleHTTPServer to set HTTP headers to tell the browser not to cache. Here's the code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/usr/bin/env python
import SimpleHTTPServer

class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_my_headers()
        SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
    def send_my_headers(self):
        self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
        self.send_header("Pragma", "no-cache")
        self.send_header("Expires", "0")
if __name__ == '__main__':
SimpleHTTPServer.test(HandlerClass=MyHTTPRequestHandler)

Usage: python serveit.py 8080 to serve the local directory on port 8080.

Source: The ever helpful stackoverflow

Another tooling post

Category: tools
#tools

Another post Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Downloading with wget

Category: Tools
#network #http #tools

Tools for downloading from the command line

wget

Details on resuming downloads with wget