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
### 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 / 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")
-- convert -coalesce image.gif ~/Documents/cin/img%02d.png
set i to 0
set wallpaper_folder to (path to home folder as string) & "Documents:cin" as alias
tell application "Finder"
set fileList to (every file of folder wallpaper_folder) as alias list
end tell
tell application "System Events"
repeat
@markolson
markolson / embed.patch
Last active August 29, 2015 14:08
Embed Metrics in Graphite Renders
From 23c9be81e4f00040018deec19c73b9484a5fa50e Mon Sep 17 00:00:00 2001
From: Mark Olson <theothermarkolson@gmail.com>
Date: Sun, 2 Nov 2014 16:11:39 -0500
Subject: [PATCH] If PIL is available, embed the metrics used to generate the
graph in the PNG. For reasons.
---
webapp/graphite/render/views.py | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
@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 / 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"
@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 / 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"];