Skip to content

Instantly share code, notes, and snippets.

View roryokane's full-sized avatar

Rory O’Kane roryokane

View GitHub Profile
@roryokane
roryokane / with_stdout.rb
Created September 11, 2013 02:52
Ruby method `with_stdout` lets you output to an arbitrary stream with `puts`, etc., for convenience
# lets you output to an arbitrary stream with `puts`, etc., for convenience
def with_stdout(new_stdout)
old_stdout = $stdout # $stdout usually be STDOUT here, but not if you nest this function
$stdout = new_stdout
yield
$stdout = old_stdout
end
@roryokane
roryokane / Lemongrass Thai Dinner Menu (Test Page).html
Created January 21, 2014 23:25
Price Clarifier, an unfinished Greasemonkey user script to fix misleading currency amounts on all web pages. I release it (the parts that are mine) under the MIT License.
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Dinner Menu</title>
<link rel="stylesheet" href="style.css">
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/099tgfp_natural_threelayout/099t1011.css"><meta name="Microsoft Theme" content="099tgfp_natural_threelayout 1011, default">
<style type="text/css">
.style7 {
font-size: xx-small;
@roryokane
roryokane / ExampleFilter.java
Created March 17, 2014 19:13
Java generic pipe and filter classes, plus examples
package pipe_foundations.example;
import pipe_foundations.Pipe;
import pipe_foundations.SimpleFilter;
public class ExampleFilter extends SimpleFilter<Integer, String> {
public ExampleFilter(Pipe<Integer> input, Pipe<String> output) {
super(input, output);
}
@roryokane
roryokane / readme.md
Last active August 29, 2015 14:16 — forked from anonymous/readme.txt
Pegs in PuzzleScript – version hosted for puzzlescript.net
@roryokane
roryokane / 1 – myers (default) algorithm.diff
Last active January 31, 2025 15:52
Comparison between Git diff algorithms: myers (default) vs. patience (example favors patience)
diff --git a/file.c b/file.c
index 6faa5a3..e3af329 100644
--- a/file.c
+++ b/file.c
@@ -1,26 +1,25 @@
#include <stdio.h>
-// Frobs foo heartily
-int frobnitz(int foo)
+int fib(int n)
@roryokane
roryokane / 1 – myers (default) algorithm.diff
Last active January 31, 2025 15:52
Comparison between Git diff algorithms: myers (default) vs. patience (example favors myers)
diff --git a/file.txt b/file.txt
index 3299d68..accc3bd 100644
--- a/file.txt
+++ b/file.txt
@@ -1,7 +1,7 @@
+abc
aaaaaa
aaaaaa
bbbbbb
bbbbbb
function intTo2DigitHex(integer) {
if (integer < 16) {
return '0' + integer.toString(16)
} else {
return integer.toString(16)
}
}
function findCollisions(numDigitsRounding, quitAfterFindingOne) {
var knownHusls = {};
@roryokane
roryokane / exploration_of_this.js
Last active October 15, 2017 06:38
Summary of this, call, and bind in JavaScript
// exploring `this` in JavaScript, and `.call` and `.bind`
// our cast
anna = {name: "Anna"};
zach = {name: "Zach"};
// how `this` works
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
@roryokane
roryokane / kernighan_2015-10-20_q&a_notes.md
Last active October 21, 2015 08:19
A summarized transcript of Brian Kernighan’s 2015-10-20 Q&A at Paperless Post

A summarized transcript of Brian Kernighan’s 2015-10-20 Q&A

The Q&A was at Paperless Post on 2015-10-20 from 6 to 8 PM.

Transcribed by Rory O’Kane. Typed on a phone and cleaned up later.

Questions from the moderator

First, some questions from an employee of Paperless Post, starting around 6:35 PM.

@roryokane
roryokane / Security of Software, Distribution Models_ It’s More Than Open vs Closed!.md
Last active May 5, 2023 16:26
formatted version of “Security of Software, Distribution Models: It’s More Than Open vs Closed!” by Nick P.

A formatted version of https://pastebin.com/EZQWbwCB to make it easier to read. Written by Nick P., not by me. There is discussion on Lobste.rs.


Security of Software, Distribution Models: It’s More Than Open vs Closed!

(originally 2014 on Schneier’s blog; revised 2018)

I’ve noticed in recent debates a false dichotomy: you can have “open source” or proprietary, but not benefits of both. Developers thinking there’s only two possibilities might miss opportunities. This is especially true for users or buyers that are concerned about source copying, ability to repair things, or backdoors. The good news is there are many forms of source distribution available. The trustworthiness of review process also varies considerably. I’m going to briefly run through some of them here.