Skip to content

Instantly share code, notes, and snippets.

View marktriggs's full-sized avatar
💭
PROGRAMMING

Mark Triggs marktriggs

💭
PROGRAMMING
View GitHub Profile

I made 7 croissants:

  • 300g flour
  • 10% sugar
  • 2% salt
  • 1% yeast
  • 70% milk
  • 45% butter

What I did:

@marktriggs
marktriggs / knuth.txt
Created March 3, 2023 08:51
the root of all evil
The improvement in speed from Example 2 to Example 2a is only about
12%, and many people would pronounce that insignificant. The
conventional wisdom shared by many of today's software engineers calls
for ignoring efficiency in the small; but I believe this is simply an
overreaction to the abuses they see being practiced by
penny-wise-and-pound-foolish programmers, who can't debug or maintain
their "optimized" programs. In established engineering disciplines as
12% improvement, easily obtained, is never considered marginal; and I
believe the same viewpoint should prevail in software engineering. Of
course I wouldn't bother making such optimizations on a one-shot job,
.text
.align 64
.Lzero:
.long 0,0,0,0
.Lone:
.long 1,0,0,0
.Linc:
@marktriggs
marktriggs / sha1.rs
Last active November 14, 2018 08:08
// Rust implementation of pseudocode from https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode
//
// Bugs: mine!
fn preprocess(message: &[u8]) -> Vec<u8> {
let message_length: u64 = message.len() as u64 * 8;
let mut result = message.to_owned();
result.push(0x80);
@marktriggs
marktriggs / lti_roster_fetch.rb
Created August 20, 2018 04:09
Fetch site memberships using LTI Context Memberships Service
#!/usr/bin/env ruby
require 'base64'
require 'net/http'
require 'openssl'
require 'securerandom'
# Standard Sakai URL for LTI services. Also available as the
# `ext_ims_lis_basic_outcome_url` parameter on an LTI launch.
#
import mysql.connector
import uuid
import time
def do_some_writes(conn, rowcount, autocommit=True):
add_row = ("INSERT INTO mark (s) values (%s)");
cursor = conn.cursor()
for _ in xrange(rowcount):
pipeline {
agent any
stages {
stage('Build') {
steps {
input("Really do the thing?")
echo 'Building..'
}
}
(mst@thweeble) ~/tmp$ sbcl
This is SBCL 1.2.4.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (defun func-a () "am I docstring or return?")
require 'atomic'
class Watchdog
def initialize(description)
@description = description
@finished = Atomic.new(false)
@thread = Thread.new do
run_monitor
end
end
@marktriggs
marktriggs / Leech.java
Last active April 21, 2017 21:00
VuFind browse changes for Solr 6
import org.apache.lucene.store.*;
import org.apache.lucene.index.*;
import org.apache.lucene.search.*;
import java.io.*;
import java.util.*;
public class Leech
{
protected CompositeReader reader;
protected IndexSearcher searcher;