Skip to content

Instantly share code, notes, and snippets.

View roryokane's full-sized avatar

Rory O’Kane roryokane

View GitHub Profile
@roryokane
roryokane / 1 – myers (default) algorithm.diff
Last active March 25, 2024 03:02
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 / 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 / FixCtrlBackspace.ahk
Created August 26, 2013 21:19
AutoHotkey script to fix Ctrl+Backspace (delete previous word) in File Explorer and Notepad
; how to write scripts: http://www.autohotkey.com/docs/
#IfWinActive ahk_class CabinetWClass ; File Explorer
^Backspace::
#IfWinActive ahk_class Notepad
^Backspace::
Send ^+{Left}{Backspace}
#IfWinActive
; source and context: http://superuser.com/a/636973/124606
@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.

@roryokane
roryokane / LICENSE.md
Last active December 5, 2022 00:31
Jerry Lawson Google Doodle enhancement – ‘R’ to restart

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@roryokane
roryokane / README.md
Last active September 30, 2020 12:53
Ruby cheat sheet – how to run a system command (shell command) and know whether it failed

The below file is a Markdown conversion of a section of an OmniOutliner document I once wrote. The nested lists below were meant to be collapsed by default, so you could expand only the branches you care about. Sadly, that’s not easy to represent in Markdown, so below you see every detail about every option.

@roryokane
roryokane / 1 – myers (default) algorithm.diff
Last active June 7, 2020 06:46
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
@roryokane
roryokane / keybase.md
Created December 4, 2019 20:22
Keybase proof (github:roryokane = keybase:roryokane)

Keybase proof

I hereby claim:

  • I am roryokane on github.
  • I am roryokane (https://keybase.io/roryokane) on keybase.
  • I have a public key ASAwywESLvZnuiuY3IA3ptHDwB8sLIlEwqm6Aii5BG8DFQo

To claim this, I am signing this object:

@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
function intTo2DigitHex(integer) {
if (integer < 16) {
return '0' + integer.toString(16)
} else {
return integer.toString(16)
}
}
function findCollisions(numDigitsRounding, quitAfterFindingOne) {
var knownHusls = {};