Create datestamped filename via Windows Run dialog

I use this a few dozen times per week. Super useful.

REM /**
REM  * Create datestamped filename via run dialog
REM  * Location: %WINDIR%/f.bat
REM  *
REM  * Usage:  [Win+R] > 'call notes from emily about project scope'
REM  * Output: 2017-11-14_call-notes-from-emily-about-project-scope
REM  * Caveats: No real string sanitization, so special chars like "&" will break it.
REM  */

@echo off
@setlocal enabledelayedexpansion

REM *** Convert everything to lowercase
REM @source https://stackoverflow.com/a/23806517

set _STRING=%*
set "_UCASE=ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set "_LCASE=abcdefghijklmnopqrstuvwxyz"
for /l %%a in (0,1,25) do (
   call set "_FROM=%%_UCASE:~%%a,1%%
   call set "_TO=%%_LCASE:~%%a,1%%
   call set "_STRING=%%_STRING:!_FROM!=!_TO!%%
)

REM *** Get system date
REM *** @source https://stackoverflow.com/a/3202796
@setlocal enableextensions
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
for /f "tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (
  for /f "tokens=%toks% delims=.-/ " %%i in ('date/t') do (
  set '%%a'=%%i
  set '%%b'=%%j
  set '%%c'=%%k))
if %'yy'% LSS 100 set 'yy'=20%'yy'%
set Today=%'yy'%-%'mm'%-%'dd'% 
ENDLOCAL & SET v_year=%'yy'%& SET v_month=%'mm'%& SET v_day=%'dd'%
set _DATE=%V_Year%-%V_Month%-%V_Day%

REM *** Replace spaces with underscores
SET _STRING=%_STRING: =_%

REM *** beep at the user!
REM *** @source https://stackoverflow.com/a/39541079
rundll32 user32.dll,MessageBeep

REM *** Fire the prompt()
mshta javascript:prompt("Filename generated successfully!","%_DATE%_%_STRING%");close();

Place in your %WINDIR% directory as f.bat and call via Win+R.

How to download protected Vimeo videos

A website I recently purchased a membership to offers the option to download their course and lesson content. Unfortunately, the only download link they offer is at 1080p video resolution, which while nice, is much larger than necessary. The videos are offered through Vimeo, but are all unlisted, private, and can only be embedded on a single domain. Given that it would be entirely legal (and not outside of any particular moral code) for me to download the full HD version, downsample, and re-encode the video, I decided to write a script that would do this for me. Re-encoding takes forever, and I don’t have that kind of time.

Read more

Flawless Email

Flawless Email

I used to be just like you.

My email was a goddamn nightmare. Sure, it started off simple enough, but over the years it evolved into something else — something messy and complicated. There was no real structure, no rhyme or reason. The unread messages started to pile up. It became problematic to find the messages that I needed to respond to in an endless sea of crap I had allegedly signed up for. Opening my inbox was a source of stress. I had to disable notifications on my phone because of the constant irritation. The hundreds of unread messages started reaching into the thousands. My friends, family, and work partners couldn’t rely on a prompt response from me. It was getting worse, and there was no end in sight.

Read more

Google Chrome Search Engines

Google Chrome is a great browser. One of the more powerful features that I use extensively is the built-in search engines. If you know how to leverage these, you can use the address bar as a command line of sorts. You can access your engines by right-clicking the address bar and selecting “Edit search engines”, or by visiting chrome://settings/searchEngines (which you will have to copy and paste, as Chrome will not let you access addresses beginning with the chrome:// prefix). They are listed by name, command, and query string. Typing the command in the address followed by a tab or space will engage the engine, and whatever you type after this will be passed as a parameter to the query. To customize your engines, the parameter is represented by “%s”, allowing you to carefully craft your query strings.

Read more