Skip to content

Instantly share code, notes, and snippets.

View jtbrough's full-sized avatar

Jordan Brough jtbrough

View GitHub Profile
@jtbrough
jtbrough / jordanbrough.omp.json
Last active April 22, 2023 18:22
Added OS logo to hostname
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#d0d5db",
"foreground": "#2d3243",
"leading_diamond": "\ue0b6",
@echo off
rem Jordan Brough 11/04/2014 6:14:19 AM
rem use fsutil to create a sequence of test files at specificed sizes (in bytes)
rem switch %% to % when running single lines from the CMD prompt
rem create 100 1MB files (total 100MB)
for /L %%i in (1,1,100) do fsutil file createnew 1MB-%%i.tmp 1048576
rem create 100 10MB files (total ~ 1GB)
for /L %%i in (1,1,100) do fsutil file createnew 10MB-%%i.tmp 10485760
#!/bin/bash
filename=~/path/to/shortened_input.txt
exec 4<$filename
while read -u4 p ; do
expanded=$(curl -sI $p | sed -n 's/Location: *//p')
if [ ${#expanded} > 0 ]
then
echo $expanded >> ~/path/to/expanded_output.txt;
else
@jtbrough
jtbrough / append_datetime.bat
Last active August 29, 2015 13:56
Prepending or appending a datetime stamp using Batch
@echo off
rem set general variables
set input_files=*.txt
rem set date/time variables (generates yyyy-mm-dd_hhmmss)
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set file_date=%%c-%%a-%%b)
for /f "tokens=1-3 delims=:." %%a in ("%TIME%") do (set file_time=%%a%%b%%c)
set date_time=%file_date%_%file_time%
# de-munge email address
#
# accepts a munged email address in one of the following formats (in this case piped from the OS X clipboard)
# 1) something at domain dot com
# or
# 2) something at domain (dot) com
# all spaces will be removed
#
echo `pbpaste` | sed -e 's/ at /@/' -e 's/ dot /./' -e 's/ (dot) /./' -e 's/ //g'
@jtbrough
jtbrough / add_to_reading_list.applescript
Created January 20, 2014 01:40
Loop through links in a text file and add each to Safari's Reading List
set fileContents to read theFile
set theURLs to every paragraph of fileContents
tell application "Safari"
repeat with theURL in theURLs
if length of theURL is greater than 0 then
add reading list item theURL
delay 1
end if
@jtbrough
jtbrough / Instapaper Text.md
Created December 26, 2013 19:56
Instapaper Text

Launches an Instapaper Text view of the current page.

@jtbrough
jtbrough / datetimestamp.bat
Created December 16, 2013 19:55
Generate Windows Batch datetime stamp in yyyy-mm-dd_hhmmss (24hr) format.
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set file_date=%%c-%%a-%%b)
For /f "tokens=1-3 delims=:." %%a in ("%TIME%") do (set file_time=%%a%%b%%c)
echo %file_date%_%file_time%
getAppName()
on getAppName()
tell application "Finder"
try
try
set appName to name of application file id "com.smileonmymac.PDFpenPro"
on error
try
set appName to name of application file id "com.smileonmymac.PDFpen"
on error
@jtbrough
jtbrough / Launch in Chrome.applescript
Last active October 7, 2015 16:38
Open current Safari page in Google Chrome
--
-- This script launches the current Safari page in Chrome (I use this for sites that require Flash).
-- It doesn't do anything to your clipboard, or use keyboard shortcuts (though it could be associated
-- with one using Keyboard Maestro or alike). It simply uses Safari's existing open in Chrome
-- functionality. It does require that the Develop menu has been enabled in Safari.
--
-- grab the current Google Chrome version number from the app bundle
tell application "System Events"
set version_str to (value of property list item "KSVersion" of contents of property list file "/Applications/Google Chrome.app/Contents/Info.plist")
end tell