Skip to content

Instantly share code, notes, and snippets.

View codesoda's full-sized avatar

Chris Raethke codesoda

View GitHub Profile
@codesoda
codesoda / ffmpeg.md
Created August 24, 2022 00:52 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@codesoda
codesoda / HttpProxy.go
Created March 14, 2022 10:01 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
const padLeft = (number, n,str) => {
return number.toString().length >= n ? number : Array(n-String(number).length + 1).join(str||'0') + number;
}
const playTime = (milliseconds) => {
let seconds = milliseconds / 1000.0,
hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60),
only_seconds = Math.round(seconds % 60),
parts = [];
@codesoda
codesoda / Gemfile
Created January 11, 2018 11:18 — forked from chezou/Gemfile
Example code of ruby with Amazon Polly
source 'https://rubygems.org'
gem 'nokogiri', '~>1.6'
gem 'aws-sdk', '~> 2'
@codesoda
codesoda / API.md
Created September 4, 2017 05:03 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@codesoda
codesoda / check.sh
Created September 9, 2016 07:14
Check apple store to see if iphone is available yet
main() {
while [[ true ]]; do
local request="$(curl -s 'http://www.apple.com/us/shop/goto/iphone_7/select' | grep 'be back soon')"
if [[ ! $request ]]; then
say 'Yep, time to buy'
break
fi
# this is running in Project 2
class MyClass
def some_process
# if the worker was in this project I could do this
# MyWorker.perform_async(...args)
# but the worker isn't in my project
# I always thought I could do this, but it seems it needs
# class: ActualClass,
# not
@codesoda
codesoda / typekit.js
Created June 28, 2016 13:35
Typekit + sessionstorage + no FOUT
<script>
(function(d) {
var tkTimeout=3000;
if(window.sessionStorage){if(sessionStorage.getItem('useTypekit')==='false'){tkTimeout=0;}}
var config = {
kitId: 'abc1234',
scriptTimeout: tkTimeout
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";if(window.sessionStorage){sessionStorage.setItem("useTypekit","false")}},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
@codesoda
codesoda / Guardfile
Last active May 12, 2016 22:23
Guard Error
# use mac notification center
notification :terminal_notifier
guard :rspec, cmd: 'bin/rspec' do
require "guard/rspec/dsl"
dsl = Guard::RSpec::Dsl.new(self)
# Feel free to open issues for suggestions and improvements
# RSpec files
@codesoda
codesoda / base.rb
Created September 28, 2015 23:03 — forked from bensie/base.rb
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base