Skip to content

Instantly share code, notes, and snippets.

View leoherzog's full-sized avatar

Leo leoherzog

View GitHub Profile
@leoherzog
leoherzog / streamvideos.sh
Created June 9, 2015 15:53
FFmpeg Directory Streamer v0.0.1
#!/bin/sh
ls | sort -R | tail -1 | while read file; do
ffmpeg -re -i $file -vcodec libx264 -preset veryfast -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -ac 2 \
-ar 44100 -f flv rtmp://a.rtmp.youtube.com/live2/xd1936.sgqg-43s7-36h5-fttg
done
@leoherzog
leoherzog / concerto.log
Created February 16, 2016 20:08
Concerto 500 Error
I, [2016-02-16T15:00:34.605789 #7447] INFO -- : Started GET "/settings" for ###.###.###.### at 2016-02-16 15:00:34 -0500
I, [2016-02-16T15:00:34.607593 #7447] INFO -- : Processing by ConcertoConfigController#show as HTML
I, [2016-02-16T15:00:34.661042 #7447] INFO -- : Rendered concerto_config/show.html.erb within layouts/application (32.0ms)
I, [2016-02-16T15:00:34.661537 #7447] INFO -- : Completed 500 Internal Server Error in 54ms (ActiveRecord: 3.4ms)
I, [2016-02-16T15:00:35.188827 #7447] INFO -- : ** [Airbrake] Success: Net::HTTPOK
F, [2016-02-16T15:00:35.191368 #7447] FATAL -- :
ActionView::Template::Error (undefined method `select_values' for #<ConcertoConfig:0x000000073f16d0>):
50: <%= label_tooltip "concerto_config", c.key.to_sym, t("activerecord.attributes.concerto_config.#{c.key.to_sym}"), tip: c.description %>
51: <div class="input">
52: <% options = "" %>
@leoherzog
leoherzog / -r-nexus5x flair.css
Created February 19, 2016 14:59
Flair Code from /r/Nexus5x
/* --- User Flair ---*/
.flair:before {
content:"";
width:10px;
height:16px;
display:inline-block;
margin-top:-2px;
background-repeat:no-repeat;
background-image:url(%%flair-phones%%);
vertical-align:middle;
@leoherzog
leoherzog / youtubeloop.js
Last active March 28, 2016 19:25
A drop-in piece of Javascript that will take an array of YouTube video IDs and embed them on the page
<script>
// Replace line below with video id(s)
// e.g. ["K0FdCdQItDI"]; or ["K0FdCdQItDI","8B3dpnUcMBY"];
//
//
var ids = ["K0FdCdQItDI"];
//
//
// Don't edit below
if (ids.length == 1) {
@leoherzog
leoherzog / addDegreeSymbol.js
Created July 23, 2016 17:56
One-Liner Javascript Code to Add in Degree Symbols to Temperatures in a String
variable = variable.replace(/[0-9]{1,3}F/g, function addDegreeSymbol(x){return x.replace("F", "°F");});
variable = variable.replace(/[0-9]{1,3}C/g, function addDegreeSymbol(x){return x.replace("C", "°C");});
@leoherzog
leoherzog / Description
Created August 7, 2016 16:39
Muzei extension for Tasker that gets local weather photos from #ProjectWeather
Muzei Weather Wallpaper Updater v2 (39)
<Kill the task if Wi-Fi isn't connected and the "Wi-Fi Only" setting is on>
A1: Stop [ With Error:Off Task:Muzei Weather Wallpaper Updater v2 ] If [ %WIFII !~ *CONNECTION* & %WWWIFIONLY ~ true ]
<Kill the task if the battery is low and the "Don't run on low battery" setting is on>
A2: Stop [ With Error:Off Task:Muzei Weather Wallpaper Updater v2 ] If [ %BATT < 15 & %WWDONTRUNONLOWBATTERY ~ true ]
A3: Variable Set [ Name:%flickrapikey To:0952e1ceeeca7a0e1b3867533ba4beff Do Maths:Off Append:Off ]
<#ProjectWeather Flickr Group ID>
A4: Variable Set [ Name:%projectweathergroupid To:1463451@N25 Do Maths:Off Append:Off ]
A5: Get Location [ Source:Net Timeout (Seconds):15 Continue Task Immediately:Off Keep Tracking:Off ]
<Turn network LAT,LONG into two variables>
@leoherzog
leoherzog / weatherSymbols.gs
Last active January 5, 2017 13:34
Turn Wunderground API or Dark Sky API Conditions into Unicode Symbols
// possible options: https://www.wunderground.com/weather/api/d/docs?d=resources/icon-sets (image file names)
function getWundergroundIcon(condition) {
var conditionEmoji = "";
if (condition.indexOf("sunny") > -1 || condition.indexOf("clear") > -1) {
conditionEmoji = "☀️ ";
} else if (condition.indexOf("partlysunny") > -1 || condition.indexOf("mostlysunny") > -1) {
conditionEmoji = "⛅ ";
} else if (condition.indexOf("partlycloudy") > -1 || condition.indexOf("mostlycloudy") > -1) {
conditionEmoji = "🌥 ";
} else if (condition.indexOf("cloudy") > -1 || condition.indexOf("fog") > -1 || condition.indexOf("hazy") > -1) {
@leoherzog
leoherzog / code.gs
Last active January 13, 2017 20:28
Sort your array of CalendarEvent objects that were returned from the Google Apps Script CalendarApp
// copy this to the bottom of your script, then call it on your array of CalendarEvent objects that you got from the CalendarApp
//
// ex:
// var sortedEvents = sortArrayOfCalendarEventsChronologically(events);
// or
// events = sortArrayOfCalendarEventsChronologically(events);
function sortArrayOfCalendarEventsChronologically(array) {
if (!array || array.length == 0) {
return 0;
@leoherzog
leoherzog / mac-vm-prep.sh
Last active March 28, 2017 19:08
Prepare Virtualbox VM to host guest MacOS
#!/bin/bash
read -p "Case-sensitive name of the VM: " vmname
if [[ -z $vmname ]]; then
echo "$(tput setaf 1)Please enter a valid VM Name$(tput sgr0)"
exit 1
fi
if [[ $vmname =~ \ |\' ]]; then
echo "$(tput setaf 3)Be warned, there have been reports that this may not work with VM Names that contain spaces$(tput sgr0)"
fi
echo "What resolution would you like the VM guest to be?"
@leoherzog
leoherzog / * set-up.md
Last active April 9, 2017 00:05
A quick-'n-dirty jQuery way of changing an HTML div contents based on if you are currently free or busy in Google Calendar
  • Make sure you are sharing at least free/busy details about your calendar to the public
  • Add freebusy.js and jQuery (with ajax support, not jQuery slim) to your project
  • Make an API Key at the Google Developers Console and enable Google Calendar support
  • Change the API key at line 5
  • Change the Google Calendar address from googlecalendarid@gmail.com to the one that you want to check on line 6
  • ???
  • Profit