Skip to content

Instantly share code, notes, and snippets.

View nornagon's full-sized avatar

Jeremy Rose nornagon

View GitHub Profile
@nornagon
nornagon / index.html
Created November 28, 2018 00:08
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created November 28, 2018 00:05
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created November 9, 2018 21:17
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created October 16, 2018 21:45
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created October 16, 2018 21:45
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / what_good_is_a_programmer
Created August 22, 2018 01:33
What good is a programmer if they can't destroy software?
#!/bin/sh
tail +3 "$0" | clang -x c -o "$0" - && exec "$0"
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <mach-o/dyld.h>
const char what_good_is_a_writer[] =
"What good is a writer if he can’t destroy literature?\n"
"And us... what good are we if we don’t help as much\n"
@nornagon
nornagon / finite_scroll.txt
Created July 2, 2018 15:48
Block infinite scroll with uBlock Origin
||twitter.com/i/timeline$xhmlhttprequest
0
SECTION
2
HEADER
9
$ACADVER
1
AC1014
9
$HANDSEED
@nornagon
nornagon / SVGMicroSyntax.scala
Last active July 1, 2021 20:35
SVG path and transform parsers in Scala, using fastparse
// License: GPLv3
// Email me and I'll grant you a free eternal license to use it however you want! nornagon@nornagon.net
object SVGMicroSyntax {
// https://github.com/lihaoyi/fastparse
import fastparse.all._
object PathData {
sealed trait PathCommand
sealed trait DrawToCommand extends PathCommand
@nornagon
nornagon / smith_waterman.py
Created July 21, 2017 04:07
Smith-Waterman Python implementation
import numpy as np
def smith_waterman(a: str, b: str, alignment_score: float = 1, gap_cost: float = 1) -> float:
"""
Compute the Smith-Waterman alignment score for two strings.
See https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm#Algorithm
This implementation has a fixed gap cost (i.e. extending a gap is considered
free). In the terminology of the Wikipedia description, W_k = {c, c, c, ...}.
This implementation also has a fixed alignment score, awarded if the relevant