Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Speak iwillspeak

View GitHub Profile
@iwillspeak
iwillspeak / eratosthenes.scm
Created Sep 4, 2020
Sieve of Eratosthenes in Scheme
View eratosthenes.scm
;; Implementation of the Sieve of Eratosthenes
;; https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
(define (eratosthenes n)
;; Mark multiples of the given prime in the vector
(define (mark-multiples p marked)
(define (mark-multiples-at p m marked)
(if (>= m (vector-length marked))
marked
(begin
(vector-set! marked m #t)
@iwillspeak
iwillspeak / thunker
Last active Dec 17, 2015
Automatic wifi router resetter control scripts. Install `thunker` into your `/usr/local/bin` on the RPi and `thunker_daemon` into your *init.d*. You will need Ruby and the `net-ping` and 'wiringpi' gems. See it in action at https://vimeo.com/66365606
View thunker
#! /usr/bin/ruby
require 'wiringpi'
require 'net/ping'
require 'syslog'
# Constants
OUTPUT_PINA = 0 # RPi Pin 11
OUTPUT_PINB = 1 # RPi Pin 12
ARM_ON_TIME = 0.1
@iwillspeak
iwillspeak / .profile Moved.md
Last active Aug 26, 2017
Bash Profile Script
View .profile Moved.md

Moved

Dotfiles are now all together at home

@iwillspeak
iwillspeak / emacs
Last active Dec 17, 2015
Emacs.app Launch ScriptThis script will nestle in yo' `/usr/local/bin` spawnin yo' Emacs.app processes to edit yo' files.
View emacs
#!/usr/bin/env python
import sys
import subprocess
import tempfile
import time
# Emacs is in the Cellar, installed by Homebrew
emacspath="/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs"
def run(cmd, args):
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active Sep 24, 2021
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@iwillspeak
iwillspeak / SampleGreeter.leet
Created Nov 2, 2012
Sketch of the class syntax for Leet
View SampleGreeter.leet
module sample
import io
/**
* Greeting class.
*
* Stores a list of greetings and prints them to the
* screen upon request
*/
@mxswd
mxswd / md2cre.rb
Created Jul 22, 2012
Convert Markdown to Creole
View md2cre.rb
#!/usr/bin/env ruby
# Invoke with `ruby md2cre.rb filename.md`
#
# Setup: `gem install redcarpet`
require 'rubygems'
require 'redcarpet'
class Creole < Redcarpet::Render::Base
def normal_text(text)
@yohhoy
yohhoy / threads.h
Last active Jun 5, 2021
C11 <threads.h> emulation library
View threads.h
/*
* C11 <threads.h> emulation library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef EMULATED_THREADS_H_INCLUDED_
#define EMULATED_THREADS_H_INCLUDED_