Skip to content

Instantly share code, notes, and snippets.

View JoshMock's full-sized avatar

Josh Mock JoshMock

View GitHub Profile
@JoshMock
JoshMock / ListFileNames.vbs
Created July 14, 2010 16:51
Prints a list of file names in a given folder to a text file.
' Results: Prints a list of file names in FOLDER_TO_CHECK to the text file at OUTPUT_FILE_LOCATION
Dim FOLDER_TO_CHECK
FOLDER_TO_CHECK = "C:\Folder\to\list\"
OUTPUT_FILE_LOCATION = "C:\Temp\ListFileNames.txt"
Dim fs, logFile, folder
Set fs = CreateObject("Scripting.FileSystemObject")
Set logFile = fs.OpenTextFile(OUTPUT_FILE_LOCATION, 2)
@JoshMock
JoshMock / RemoveFileNameCharacters.vbs
Created July 14, 2010 16:57
Given a folder full of files, replaces one string for another in each file name.
' Results: Looks at the names of all files in FOLDER_TO_SCAN, replacing any instance of STRING_TO_REPLACE with REPLACE_WITH in each filename.
Dim FOLDER_TO_SCAN, STRING_TO_REPLACE, REPLACE_WITH
FOLDER_TO_SCAN = "C:\Folder\to\scan\"
STRING_TO_REPLACE = "replace this"
REPLACE_WITH = "with this"
Dim fso, folder
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(FOLDER_TO_SCAN)
@JoshMock
JoshMock / RemoveDuplicateLines.vbs
Created July 14, 2010 17:09
Scans an input text file that has been sorted alphabetically and outputs all unique lines to an output text file.
' Results: Scans READ_FILE and outputs all unique lines to WRITE_FILE.
' Assumes: Text file has been sorted alphabetically
' TODO: Universal search for line so file doesn't need to be sorted.
Dim READ_FILE, WRITE_FILE
READ_FILE = "C:\Input\textfile.txt"
WRITE_FILE = "C:\Output\textfile.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set inputFile = fso.OpenTextFile(READ_FILE, 1) '1 = for reading
@JoshMock
JoshMock / GenerateSplashForFLV.vbs
Created July 14, 2010 17:33
Recurses through directories and creates a screen capture for each FLV video file and outputs as a JPG.
' Results: Recurses through all subdirectories of FOLDER_TO_SCAN and finds all .FLV files that do not have an associated JPG splash image, then creates one 5 seconds into the video using FFMPEG command line tool.
' Assumes: FFMPEG (http://ffmpeg.org) command line tool is installed and its install directory is in the system Path variable.
Dim FOLDER_TO_SCAN
FOLDER_TO_SCAN = "C:\Folder\to\scan\"
Dim fso, rootFolder, convertedCount
Set fso = CreateObject("Scripting.FileSystemObject")
Set rootFolder = fso.GetFolder(FOLDER_TO_SCAN)
@JoshMock
JoshMock / .bash_profile
Created September 13, 2010 15:02
.bash_profile
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PS1="\[$(tput setaf 1)\][\!] \[$(tput setaf 2)\]\w $ \[$(tput sgr0)\]"
alias crontab="VIM_CRONTAB=true crontab"
PS1='\[\e[0;32m\][\t]\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]'
@JoshMock
JoshMock / .vimrc
Created November 4, 2010 00:21
Vim settings
" Pathogen settings to auto-load new plugins (http://www.vim.org/scripts/script.php?script_id=2332)
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on
"Enable filetypes
filetype on
filetype plugin on
filetype indent on
@JoshMock
JoshMock / app.js
Created November 16, 2010 05:29
Sample Titanium App - Wikipedia search
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create base UI tab and root window
var window = Titanium.UI.createWindow({
title:'Search',
backgroundColor:'#fff'
});
var textfield = Titanium.UI.createTextField({
@JoshMock
JoshMock / gist:5527082
Created May 6, 2013 18:32
Ana Sia Moogfest 2012 setlist
Julio Bashmore - Au Seve
Ill Blue - 2nd Nature
Midland - Placement (Lone Remix)
Grenier - RDY4U
Joy Orbison & Boddika - Dun Dun
Portishead - Machinegun (Jimmy Edgar Edit)
Grenier - DTF (ft Salva)
Astronomar - Sword Fight (Kid Kamillion Edit)
Mike Q - Let It All Out
the Goonies - Africa
@JoshMock
JoshMock / moveshit
Created July 11, 2013 01:17
Move windows around in AppleScript
try
tell application "Google Chrome"
set the bounds of the second window to {-1400, 0, -100, 900}
set the bounds of the first window to {100, 0, 1500, 2000}
end tell
end try
try
tell application "Mail"
set the bounds of the first window to {-1400, 0, -100, 900}