Instantly share code, notes, and snippets.

View streamable.sh
ffmpeg -i input.mov -profile:v high -level 4.1 -movflags +faststart -vcodec libx264 -r 24 -s 1280x720 -preset slow -crf 24 -acodec libfaac -ac 2 -ab 128k -threads 4 -tune zerolatency output.mp4
View curl-succeeds.sh
until [ $? -eq 0 ]; do curl -I --fail example.com; done
View Corrupcion-IHSS.txt
Febrero 2010
http://www.laprensa.hn/honduras/505754-97/mario-zelaya-nuevo-director-del-seguro
Junio 2010
http://archivo.elheraldo.hn/Ediciones/2010/06/29/Noticias/Lobo-analiza-pago-de-1-523-millones-al-IHSS
Agosto 2010
http://old.latribuna.hn/2010/08/11/doctor-mario-zelaya/
Enero 2011
View playbook.yml
---
- hosts: localhost
tasks:
- name: ensure Git is installed
apt: pkg=git state=present
- name: ensure Nginx is installed
apt: pkg=nginx state=present
- name: ensure Monit is installed
apt: pkg=monit state=present
View honduras_municipios.rb
department = Departamento.create(:name=>"ATLANTIDA",:num=>1)
Municipio.create(:name=>"LA CEIBA",:num=>1,:departamento_id=>department.id)
Municipio.create(:name=>"EL PORVENIR",:num=>2,:departamento_id=>department.id)
Municipio.create(:name=>"ESPARTA",:num=>3,:departamento_id=>department.id)
Municipio.create(:name=>"JUTIAPA",:num=>4,:departamento_id=>department.id)
Municipio.create(:name=>"LA MASICA",:num=>5,:departamento_id=>department.id)
Municipio.create(:name=>"SAN FRANCISCO",:num=>6,:departamento_id=>department.id)
Municipio.create(:name=>"TELA",:num=>7,:departamento_id=>department.id)
Municipio.create(:name=>"ARIZONA",:num=>8,:departamento_id=>department.id)
department = Departamento.create(:name=>"COLON",:num=>2)
View chef_solo_bootstrap.sh
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
rvm requirements
rvm install 2.0.0
source /etc/profile.d/rvm.sh
gem install chef ruby-shadow --no-ri --no-rdoc
View spherical_point_at_distance.rb
def point_at_distance(center, distance, bearing=180)
pi = Math::PI
r_e = 6378137.0 #meters
d = distance/r_e
lat1 = (pi/180) * center.latitude
lng1 = (pi/180) * center.longitude
tc = (pi/180) * bearing
y = Math.asin(Math.sin(lat1)*Math.cos(d)+Math.cos(lat1)*Math.sin(d)*Math.cos(tc))
View circle_path
def self.circle_path(center, radius, complete_path = false)
# For increased accuracy, if your data is in a localized area, add the elevation in meters to r_e below:
r_e = 6378137.0
@@d2r ||= Math::PI/180
@@multipliers ||= begin
segments = 16
dRad = 2*Math::PI/segments
(segments + (complete_path ? 1 : 0)).times.map do |i|
rads = dRad*i
y = Math.sin(rads)
View buy.js
//you will need to install node.js and restler first
//npm install restler
//run with the following command
// node buy.js
var sys = require('util'),
rest = require('restler');
//set these to your coinbase API key, the amount you want to buy & the price that you're expecting for
View price_check.rb
require 'nokogiri'
require 'open-uri'
require 'terminal-notifier'
title = 'Bitcoin Gem'
activate = 'com.googlecode.iterm2'
current_price = 0
while 1