TheShed

Encoding with FFMEG

Category: tools
#video #encoding #tools

Wow. iOS is fussy about MPEG4 encoding. Stuff that worked fine as HTML5 video sources in Chrome and Safari on a Mac failed to load in various i-devices. In the end I re-encoded using FFMPEG and:

ffmpeg.exe"  -i input.mov -codec:v libx264 -profile:v main -preset slow -b:v 2000k -maxrate 400k -bufsize 800k -vf scale=-1:1080 -threads 0 -codec:a libvo_aacenc -b:a 192k output.mp4

Storage Pools

Category: Tools
#Windows #Storage #Backup

If you're not restoring you're not backing up

Windows Server has this neat feature: Storage Pools. In a nutshell it separates the logical storage from physical devices. I use it to make two physical hard drives appear as one logical disk. Anything saved to the pool is mirrored to both disks. In theory, this means that a failure of one physical drive won't loose any data since a copy is available on the second.

Last week I had a drive failure. It wasn't either of the drives in the storage pool. Instead the system drive (a third drive hosting the OS) had failed.

I think it took me 40 minutes to be up and running enough to validate the data was okay.

  1. Install replacement system disk
  2. Reinstall Windows Server 2012 R2
  3. Reconnect two physical disks hosting the storage pool
  4. Trawl the interwebs for details of how to reattached the storage pool

Job done (except for the reboots and updates and reboots and updates thing...).

One trick, Windows server doesn't automatically mount a newly attached pool on reboot. Here'e the PowerShell rune to chnage that:

Get-VirtualDisk | Where-Object {$_.IsManualAttach eq $True} | Set-VirtualDisk –IsManualAttach $False

More on MPD

Category: Tools

More jottings on MPD (previously on m a n n i n g t r e e)

Youtube-dl

Category: Tools

For those occasions where you don't have the bandwidth to watch something without buffering: youtube-dl.

On a Mac:

  1. sudo pip install youtube-dl
  2. brew install libav
  3. youtube-dl <url>

If bandwidth is a real pain and you just want the audio...

youtube-dl --extract-audio --audio-format mp3 <url>

To update:

sudo pip install -U youtube-dl

Secure Copy

Category: Tools
#Sysadmin #linux #mac

Simple scp from remote to me:

$ scp username@remotehost:file.txt /some/local/directory

Simple scp from me to remote:

$ scp file.txt username@remotehost:remote/directory

Here's a cheat sheet

cURL on Windows (thanks Git)

Category: Tools
#Programming

cURL is a nifty little tool for doing things with the web (like HTTP Requests). It's expecially useful for playing with REST APIs...

A coleague was having some fun calling into the REST API of our issue tracking system. A perfect job for cURL I thought, until I remembered that I was VPN'd on a Windows box from a hotel bar...

Fortunately, the Git windows tool set includes Git Bash which includes... cURL

curl -D- -X PUT --data '{ "fields": {"assignee":{"name":"me"}}}' -H "Content-Type:application/json" https://testserver/rest/api/2/issue/Issue-135

curl -D- -X GET -H "Content-Type: application/json" https://testserver/rest/api/2/issue/Issue-134

to the rescue :-)

(Don't forget -u)

PS: I just stumbled on the fact that Git Bash also includes scp. What goodness\tm!

OneDrive from Python

Category: Tools
#programming #python #onedrive

A nice commandline tool (based on a Python wrapper for the OneDrive REST API) for working with OneDrive.

pywin32 0. Setup a Python Virtual Environment 1. On Windows, install pywin32 . From the venv use easy_install http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download (with the path to the right pywin32 for your system and Python version...) 2. pip install pyyaml 3. pip install python-onedrive[standalone] 4. Register your app with the OneDrive service (to get the client and secret keys). MSDN details 5. Create a configuration file with the client ID and secret:

client:
  id: <client id here>
  secret: <secret key here>
  1. Auth dance onedrive-cli auth

Then use. For example onedrive-cli ls to list content stored in OneDrive.

Bonus thought

The OneDrive web service now has some basic Markdown support in the webage text editor, but http://dillinger.io/ is nice too ;-)

Send to Kindle

Category: Tools
#python #Kindle

A nice little Python Script to send documents to Amazon Kindle via a command line.

(It works too :-)

More Mac OS Tips

Category: Tools
#Mac OS X #Tips

Some Mac Tips...

Copy and Paste

to open the go to dialog, then:

CTRL + V

to paste.

Links

Create a link to an application so I can easily run from a shell:

ln -s "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

Bash

Bash setting are in the .profile file.

To set a path:

export PATH=~/bin:$PATH

To create an alias to a command:

alias qc="~/bin/qc.sh"

Then reload the .profile using the following from your home directory:

. ./.profile

(Use ls -a to show . files)

Making Word documents from Markdown

Category: Tools
#text #markdown #documents

Markdown is awesome.

So awesome that there's even a standardization effort to create one common markdown. XKCD on standards

Aside

Aside: James asked what the big appeal was. For me it's a plain text format that has built in context with minimal distracting markup. As example:

# I am a title in **Markdown**

\chapter{I am a chapter title in \textbf{\LaTeX}}

<h1>I am a heading title in <strong>HTML</strong></h1>

End Aside

Markdown in Sublime text distraction free mode might be the best authoring environment, but it's far from the best reading (especially for non-Markdown fanatics). Fortunately, pandoc exists to make conversions between formats easy. For example, to create co-worker friendly documents form .md files I use:

pandoc -s --reference-docx=reference\reference.docx -o %1.docx %1

Where reference.docx is a regular OOXML file (from MS Word) that sets up my default styles so that, for example, Markdown regular text uses the Segoe UI Light font family.

Nice.

Reference