Skip to content

Instantly share code, notes, and snippets.

@topher6345
topher6345 / vj.sh
Last active December 15, 2015 09:38
A bash shell script using ffmpeg to encode all the .mov files in the current directory to Motion-Jpeg, to use in MaxMSP/Jitter.
#!/bin/bash
# Script using ffmpeg to convert all the .mov files in the current
# directory to "Motion Jpeg".mov codec
# Remember to $chmod
for ff in *.mov;
do
filename=$(basename $ff)
extension=${filename##*.}
<CsoundSynthesizer>
;<CsOptions>
;</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 1
;nchnls = 2
0dbfs = 1
gir ftgen 1, 0, 8192, 10, 1
@topher6345
topher6345 / set_permissions.rb
Created March 22, 2014 02:16
Automatically set all permissions in bucket.
#!/usr/bin/ruby
# usage: set_permissions.rb [access_key_id] [secret_access_key] [bucket_name]
# -----------------------------------------------------------------------------
# This script provides a means of updating all of the files in an S3 bucket to
# have the correct permissions. As this script is effectively throwaway it
# doesn't do much beyond making sure it runs at least once, however, is worth
# keeping around as a reference in the event the problem arises again.
# -----------------------------------------------------------------------------
require 'rubygems'
@topher6345
topher6345 / reddit_samples.rb
Created April 26, 2014 00:06
Sample individual words of a reddit post
require 'nokogiri'
require 'open-uri'
site = 'http://reddit.com/r/showerthoughts/.xml'
doc = Nokogiri::HTML(open(site))
filenames = []
doc.css("title")[3].children.text.gsub(/"/, "").split(' ').each_with_index do |word, i|
@topher6345
topher6345 / printf.asm
Last active July 16, 2021 16:23
Print a decimal formatted 8-bit integer in simplified assembly.
; printf(int)
; by Topher6345
; Prints a decimal-formatted, positive 8-bit integer to stdout.
; for Simple 8-bit Assembler Simulator
; http://schweigi.github.io/assembler-simulator/index.html
JMP start
hello: DB 78 ; int *hello; The number we wish to print;
@topher6345
topher6345 / modulo.asm
Last active August 29, 2015 14:02
Integer modulo subroutine implementation in simplified assembly.
; int mod(int a,int b)
; by Topher6345
; Implements a integer modulo function
; for Simple 8-bit Assembler Simulator
; http://schweigi.github.io/assembler-simulator/index.html
JMP start
ARG1: DB 13 ; Variable
@topher6345
topher6345 / README.md
Last active August 29, 2015 14:02
Common Lisp HackNight #1

Common Lisp HackNight1

YESYES

Background

yes is a program that prints y over and over, meant to be piped into the input of programs requiring confirmation.

Our task is to write a program in Common Lisp that prints YES in a similar manner.

@topher6345
topher6345 / binet.md
Last active September 22, 2022 21:48
Binet's Fibbonacci formula in ruby

Binet's Fibbonacci formula

Fibonacci algorithms come up frequently in coding interviews and programming excercises.

I'll compare two techniques for generating fibonacci numbers in ruby

  • Dynamic programming
  • Binet's formula
@topher6345
topher6345 / arithmetic.asm
Last active August 29, 2015 14:03
Various Algorithms to swap variables in Simplified assembly
; Swap Registers A & B with no tmp
JMP start
ARG1: DB 13 ; Variable
ARG2: DB 3 ; Variable
start:
MOV A, [ARG1] ; A = ARG1;
MOV B, [ARG2] ; B = ARG2;
@topher6345
topher6345 / html2markdown.rb
Created July 12, 2014 00:59
HTML to Markdown converter using ruby
#!/usr/bin/env ruby
require 'html2markdown'; puts HTMLPage.new(:contents => ARGF.read).markdown