Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
MSG=$(shuf -n 1 facts.txt)
TIME=$(date +"%I:%M %p")
FROM="+1AAABBBCCCC"
TO="+1XXXYYYZZZZ"
twilio api:core:calls:create --method GET --to $TO --from $FROM --twiml "<Response><Pause length='1'/><Say voice='alice'>This is your cat fact for $TIME</Say><Pause length='1'/><Say voice='alice'>$MSG</Say><Play>https://orangefreesounds.com/wp-content/uploads/2022/05/Cute-cat-meow-sound.mp3</Play></Response>"
@markolson
markolson / vm.rb
Last active December 9, 2019 05:37
Advent VM
$TRACE ||= ENV['TRACE']
$PROFILE ||= ENV['PROFILE']
require 'ruby-prof' if $PROFILE
class IVM
attr_accessor :memory, :inputs, :ops, :halted
attr_accessor :name, :external_ref
attr_accessor :input_proc, :output_proc, :has_signal, :halt_proc
@markolson
markolson / load_chef_node.rb
Created December 7, 2013 05:00
Pass a environment name, node name, and path to a JSON file with a run_list in it, and get back a node that you can call merged_attributes on to get (pretty dang close to) what the node will have as it's attributes during a run. Useful for updating docs to have up-to-date with a pre-commit hook.
# I'm sure this can all be replaced with a one liner, buried deep in chef somewhere.
# Actually, probably Chef::Client.
require 'json'
require 'chef'
require 'chef/application/solo'
require 'chef/knife/deps'
def setup_node(environment, name, node_config_path)
Chef::Config[:config_file] = ".chef/knife.rb"
### Keybase proof
I hereby claim:
* I am markolson on github.
* I am markolson (https://keybase.io/markolson) on keybase.
* I have a public key ASDuHk-mQyCK1gVkBivuCiA5e_PUOl19CLLoYp0t1Ed0KQo
To claim this, I am signing this object:
@markolson
markolson / dependencies.md
Created December 9, 2013 18:21
Sample License Finder output

LicenseFinder

As of December 9, 2013 1:20pm. 61 total, 6 unapproved

Summary

  • 54 MIT
  • 2 other
  • 2 ruby
  • 1 Apache 2.0
  • 1 BSD
@markolson
markolson / cbr_to_cbi.py
Last active December 17, 2015 00:48
Sync folders of CBI/CBR/CBZ files to ComicZeal.
#!/usr/local/bin/python
# CopyPaste/print programming & debugging at it's finest.
import os, re, sys, subprocess, time
import zipfile, tempfile
import sqlite3
def main():
print sys.argv
@markolson
markolson / rps-golf.exs
Last active December 11, 2015 23:45
Elixir Rock Paper Scissors Golf
import Enum
t = 'rps'
c = fn(s)-> into(s,HashSet.new) end
s = (IO.gets'') |> String.strip |> String.to_char_list
case count(Set.difference(c.(s),c.(t))) do
0 when length(s)==3-> ->
e = for x<-s, do: {x,random(t)}
x = sum(map(e,fn(x) -> case x do {x,x}->0;{?r,?s}->1;{?p,?r}->1;{?s,?p}->1;_->-1 end end))
IO.puts map(e,&(elem(&1,1)))
IO.puts(x<0&&"Lose"||x>0&&"Win"||"Draw")
@markolson
markolson / gist:3045483
Created July 4, 2012 05:14 — forked from akisute/gist:1141953
Create an animated gif file from images in iOS
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
@markolson
markolson / stream.sh
Created May 24, 2012 00:59
Play justintv streams in VLC
STREAM=`curl -d "channelname=$1&hoster=justin" http://bogy.mine.nu/sc2/stream2vlc.php | jshon -e 360p -u`
echo "rtmpdump $STREAM | vlc -" | pbcopy
echo 'now, paste, enter, play.'
@markolson
markolson / run.sh
Created May 10, 2012 15:35
Webdriver/Capybara runner.
if [ -f /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ]; then
browser="chrome"
elif [ -f /Applications/Firefox.app/Contents/MacOS/firefox ]; then
browser="firefox"
else
echo "Neither Chrome nor Firefox found. Install one."
exit
fi
echo "This opens a screen session with several windows. Once testing is complete, exit all of them to return to this terminal"
DIR="$( cd "$( dirname "$0" )" && pwd )"