Skip to content

Instantly share code, notes, and snippets.

View tncbbthositg's full-sized avatar

D. Patrick Caldwell tncbbthositg

View GitHub Profile
@tncbbthositg
tncbbthositg / gist:4350639
Created December 21, 2012 04:24
Extension method for combining predicates and extension method for or conditions in linq queries.
public static IQueryable<T> WhereAny<T>(this IQueryable<T> source, params Expression<Func<T, bool>>[] predicates)
{
Expression<Func<T, bool>> filter = t => false;
foreach (var predicate in predicates)
filter = filter.Combine(Expression.OrElse, predicate);
return source.Where(filter);
}
@tncbbthositg
tncbbthositg / README.md
Created March 9, 2022 20:40
OSX Command Line Encryption

Converting OpenSSH private key to RSA private key

ssh-keygen -p -N "" -f ~/.ssh/id_rsa -m pem

Creating a public key

ssh-keygen -e -m PKCS8 -f ~/.ssh/id_rsa
@tncbbthositg
tncbbthositg / gist:1bab06dbf823dfcb8f31f899512fd61c
Last active August 5, 2019 06:40
Stitching 360 videos from mi sphere
# ffmpeg -i steep_turn_corrected.MOV -acodec copy -vcodec copy steep_turn_corrected.mp4
# exiftool -ProjectionType="equirectangular" photo.jpg
ffmpeg -i hatcher_birthday1.MOV -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate0.ts
ffmpeg -i hatcher_birthday2.MOV -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "concat:intermediate0.ts|intermediate1.ts" -c copy -bsf:a aac_adtstoasc hatcher_birthday.mp4
@tncbbthositg
tncbbthositg / .vimrc
Last active June 4, 2018 13:24
The vim configuration I use for development
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/syntastic'
Plug 'vim-airline/vim-airline'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-commentary'
Plug 'slim-template/vim-slim'
Plug 'kchmck/vim-coffee-script'
[core]
safecrlf = true
pager = "less -FX"
excludesFile = ~/.gitignore
[alias]
co = checkout
ci = commit
st = status
pr = pull --rebase
@tncbbthositg
tncbbthositg / _text.scss
Last active December 11, 2015 00:07
Creating media specific alignments in SCSS
@mixin media-specific-styles($class) {
%#{$class} { @content; }
@each $size, $dim in $mq-sizes {
@include breakpoint($size) {
%#{$class}--#{$size} { @content; }
.#{$class}--#{$size} { @extend %#{$class}--#{$size}; }
}
}
}
@tncbbthositg
tncbbthositg / login_helper.rb
Last active October 6, 2015 16:34
Rspec helper module that logs in a user and avails that user to scenarios
module LoginHelper
def sign_in(user)
@signed_in_user = user
visit root_path
fill_in "Username", with: user.username
fill_in "Password", with: user.password
click_on "Log in"
end
@tncbbthositg
tncbbthositg / gist:2973839
Created June 22, 2012 16:26
XSS Attack Test Script
<script>alert('');</script>
@tncbbthositg
tncbbthositg / gist:2031107
Created March 13, 2012 19:44
Confirming action with a popup...
// Usage examples
//
// Calls the default asp.net event for the control
// OnClientClick = "return confirmAction('Are you sure?', this);"
//
// Uses your own function
// OnClientClick = "return confirmAction('Are you sure?', function() { window.alert('No Way!'); });"
//
// Uses built in browser confirmation
// OnClientClick = "return confirmAction('Are you sure?');"
// basic example
$('span').filter(function() {
return this.innerHTML.match(/\b(fire|aqua|elec|wood)\b/gi);
}).css("border", "1px solid red");
// styling each individual word
var fire = "<span style='border: 3px solid red;'>fire</span>";
var aqua = "<span style='border: 3px solid blue;'>aqua</span>";
var elec = "<span style='border: 3px solid gray;'>elec</span>";