Skip to content

Instantly share code, notes, and snippets.

@nbrew
nbrew / compressandupload.sh
Created November 16, 2015 03:29 — forked from thomastraum/compressandupload.sh
watch files, compress with handbrake, and move to a folder, for example a Dropbox folder.
#!/bin/bash
# use with 'fswatch . ./compressandupload.sh'
# https://github.com/alandipert/fswatch
# moves compressed files to a sub dir called "handbraked", which you need to create first
echo "---------- starting"
OUTPUTDIR="/your/path/here"
FILES=*
for f in $FILES
@nbrew
nbrew / delayed_job_init.sh
Last active March 13, 2018 18:55 — forked from stuzart/gist:3169625
Simple init script for starting group of delayed_job workers.
#!/bin/sh
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
APP_PATH="/srv/rails/seek"
APP_NAME="Seek"
APP_USER="www-data"
NUM_WORKERS="1"
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@nbrew
nbrew / Gemfile
Last active December 27, 2015 17:39 — forked from gorenje/Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
@nbrew
nbrew / gist:6393764
Last active December 22, 2015 01:08 — forked from anonymous/gist:4410510
iOS - Fade from the splash screen to your initial view.
// based on and inspired by https://gist.github.com/1026439 and https://gist.github.com/3798781
//
// MIT license. Use however you'd like.
//
// first, define our macro for delaying our transition:
#define PKWaitDelay(dly, block) dispatch_after(dispatch_time(DISPATCH_TIME_NOW,dly*100000),dispatch_get_main_queue(), ^{ block })
// then, inside your AppDelegate.m in didFinishLaunchingWithOptions:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.window.frame];
@nbrew
nbrew / README.md
Created March 29, 2012 23:41 — forked from cypriss/README.md
Rails 2.3.14 Ruby 1.9.3 - Monkey Patches
@nbrew
nbrew / authinabox.rb
Created December 7, 2011 20:29 — forked from peterc/gist:40246
Single File Data Mapper Authentication for Sinatra
# NAME: authinabox
# VERSION: 1.01 (Dec 27, 2008)
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ]
# DESCRIPTION: An "all in one" Sinatra library containing a User model and authentication
# system for both session-based logins OR HTTP Basic auth (for APIs, etc).
# This is an "all in one" system so you will probably need to heavily tailor
# it to your own ideas, but it will work "out of the box" as-is.
# COMPATIBILITY: - Tested on 0.3.2 AND the latest rtomayko Hoboken build! (recommended for the latter though)
# - NEEDS DataMapper!
# - Less work needed if you use initializer library -- http://gist.github.com/40238
@nbrew
nbrew / YodaSpeak.rb
Created August 10, 2010 22:53 — forked from LeipeLeon/YodaSpeak.rb
YodaSpeak translator in ruby with added pivot words
# port of http://www.perlmonks.org/?node_id=162190
#
# Please refactor this if necessary
# leonb -at- beriedata -dot- nl
#
class String
def yoda
word = %w{is be will show do try are teach have look help see can learn has}.select { |word| self =~ /\b#{word}\b/ }[0]
if word
x = (self =~ /\b#{word}\b/) + word.size