Skip to content

Instantly share code, notes, and snippets.

View justinmeiners's full-sized avatar

Justin Meiners justinmeiners

View GitHub Profile
@justinmeiners
justinmeiners / crypto.md
Last active June 16, 2019 04:07
Cryptocurrency Notes

Security

Technology is never the root of system security. Technology is a tool to help people secure what they value. Security requires people to act.

The way to beat the $5 wrench attack is to bear arms. Either your own, or employ guards, or use a safety deposit box, or rely on the police forces and army; or whatever may be appropriate and proportionate in your situation. If someone physically overpowers you then no technology on Earth can save your bitcoins.

@justinmeiners
justinmeiners / downloader.js
Last active November 28, 2018 21:06
Delegate example.
// notice that downloader doesn't need to import user interface
class Downloader {
// delegate has startDownload and finishDownload
constructor(delegate) {
this.delegate = delegate;
}
downloadFile() {
python -m json.tool
@justinmeiners
justinmeiners / sample_net.net
Created February 5, 2019 03:49
Sample of hosting a Neural Net in a gist.
fAEBABAAEgDgAAoBAQAAAAEABQAAAAEAAQBOAdwABAAAAAQAAAAAAAEAAAACAAAAAwAAAAEACADmAMQAAQAAAAEABAAAAAEAAADmAEYBAQAAAAEABgAAAAEAAgDqAJIBAQAAAAEABwAAAAEAAwByAP8AAAAAAAAABAAEAAUABgAHAIIB4AABAAAAAQAIAAAAAQAJAMUB4AABAAAAAQAJAAAAAQAKAPwB4gABAAAAAQAKAAAAAQALAP0BFgEBAAEAAQALAAAAAQAMAMQBGAEBAAEAAQAMAAAAAQANAIMBGgEBAAEAAQANAAAAAQAOAIYBUgEBAAAAAQAOAAAAAQAPAMIBUQEBAAAAAQAPAAAAAQAQAAACTwEBAAAAAQAQAAAAAQARAGwC9QABAAAAAQARAAAAAAACAAEAAAABAAMAAQAEAAEABQACAAUAAAAFAAMABQAEAAEABgAGAAcABwAIAAgACQAJAAoACgALAAsADAAMAA0ADQAOAA4ADwA=
@justinmeiners
justinmeiners / factorial.cpp
Created February 5, 2019 05:18
The template meta-programming "Hello World".
#include <iostream>
template<int N>
struct Factorial {
enum {
value = N * Factorial<N - 1>::value,
};
};
template <>
@justinmeiners
justinmeiners / jonesforth.f.txt
Last active October 1, 2021 22:14
How to write a Forth compiler. Mirror of Jonesforth (I did not write this.)
\ -*- text -*-
\ A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*-
\ By Richard W.M. Jones <[email protected]> http://annexia.org/forth
\ This is PUBLIC DOMAIN (see public domain release statement below).
\ $Id: jonesforth.f,v 1.17 2007/10/12 20:07:44 rich Exp $
\
\ The first part of this tutorial is in jonesforth.S. Get if from http://annexia.org/forth
\
\ PUBLIC DOMAIN ----------------------------------------------------------------------
\
@justinmeiners
justinmeiners / forth.md
Last active February 11, 2022 15:09
Notes on the Forth programming language.
@justinmeiners
justinmeiners / mccarthy.lisp
Created February 16, 2019 17:56
Mirror from Paul Graham's site. (I don't want to keep hunting down that link.)
; The Lisp defined in McCarthy's 1960 paper, translated into CL.
; Assumes only quote, atom, eq, cons, car, cdr, cond.
; Bug reports to [email protected].
(defun null. (x)
(eq x '()))
(defun and. (x y)
(cond (x (cond (y 't) ('t '())))
('t '())))

The page should be designed like a series of filters. Each function inputs a DOM tree, and returns a modified DOM tree. Filters can be chained together to produce the final results. Different filters can be chosen conditionally at each stage.

1. DOM stripping.

This phase is a removal of elements which are not relevant to text. Certain tags, can be completely blacklisted. These include:

  • <button>
  • <input>
  • <script>
  • <canvas>
  • ``