Skip to content

Instantly share code, notes, and snippets.

@nbrew
nbrew / sos.c
Last active September 1, 2016 02:53
Arduino SOS (Work in Progress)
/**
* SOS for a single LED
*
* @author Nathan Hyde
* @version 2016-08-31
*/
// Define the Pins
int LED=13; // use the arduino's built-in led on pin 13
@nbrew
nbrew / README.md
Created April 25, 2016 19:47
Loop an Existing Video Using FFMPEG

Loop Video Bash Script

Copys (loops) an existing mp4 file x times into a new file. Useful for taking short source video files and looping many times for use in BrightSign player.

@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 / recodetowin.sh
Created August 25, 2015 00:16
Use `recode` to re-encode text files to CP1252
#!/bin/bash
# cd DEEPLINK-*
# find . -d -name DATA -exec recodetowin {} \;
function recodeifneeded(){
# Find the current encoding of the file
encoding=$(file -I "$1" | sed "s/.*charset=\(.*\)$/\1/")
if [ "binary" == "${encoding}" ]; then
@nbrew
nbrew / README.md
Last active August 29, 2015 14:26
Install Syncthing with Chocolatey
@nbrew
nbrew / print_disk_usage.sh
Created August 3, 2015 17:22
Print disk usage of each directory from the command line.
#!/bin/bash
#
# USAGE: print_disk_usage.sh [/path]
# # print from /
# print_disk_usage.sh
#
# # start in /usr/local
# print_disk_usage.sh /usr/local
#
@nbrew
nbrew / BrightSign-NoAudio-Handbrake-Preset.plist
Last active August 29, 2015 14:16
Handbrake video encoding preset for BrightSign playback devices
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>AudioAllowAACPass</key>
<integer>1</integer>
<key>AudioAllowAC3Pass</key>
<integer>1</integer>
<key>AudioAllowDTSHDPass</key>
@nbrew
nbrew / sqlite3_adapter_patch.rb
Last active August 29, 2015 14:15
Monkey Patch for rails 3 and sqlite3 boolean fields
# config/initializers/rails3_sqlite3_adapter_patch.rb
# source: http://stackoverflow.com/a/20339198/2141283
require 'active_record/connection_adapters/sqlite_adapter'
module ActiveRecord
module ConnectionAdapters
class SQLite3Adapter < SQLiteAdapter
def quoted_true; '1' end
def quoted_false; '0' end
end
@nbrew
nbrew / FillScreen.cs
Created August 28, 2014 20:30
Unity 3D Make an object full the screen.
using UnityEngine;
public class FillScreen:MonoBehaviour
{
void Update() {
Camera cam = Camera.main;
float pos = (cam.nearClipPlane + 0.01f);
transform.position = cam.transform.position + cam.transform.forward * pos;
@nbrew
nbrew / FadeTest.cs
Created August 28, 2014 20:25
Unity 3D FadeTest - Fade object alpha over time.
using UnityEngine;
using System.Collections;
public class FadeTest : MonoBehaviour
{
Color startColor;
Color currentColor;
Color endColor;
bool shouldFade = false;
float startTime;