Skip to content

Instantly share code, notes, and snippets.

View sritchie's full-sized avatar
🎯
Focusing

Sam Ritchie sritchie

🎯
Focusing
View GitHub Profile
from setuptools import find_packages, setup
# This follows the style of Jaxlib installation here:
# https://github.com/google/jax#pip-installation
PYTHON_VERSION = "cp37"
CUDA_VERSION = "cuda101" # alternatives: cuda90, cuda92, cuda100, cuda101
PLATFORM = "linux_x86_64" # alternatives: linux_x86_64
BASE_URL = "https://storage.googleapis.com/jax-releases"
This file has been truncated, but you can view the full file.
#!/usr/bin/env node
if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) {
Math.imul = function (a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
This file has been truncated, but you can view the full file.
#!/usr/bin/env node
if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) {
Math.imul = function (a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
@sritchie
sritchie / hashfs.py
Last active January 30, 2020 20:22
Content addressable file manager, rewritten to use pyfilesystem2
import hashlib
import io
import os
from contextlib import closing
from typing import Iterable, Optional, Tuple, Union
import fs as pyfs
import util as u
from fs.permissions import Permissions
@sritchie
sritchie / fix_kanji_colorizer.py
Last active October 31, 2017 14:07
Instructions for how to have Kanji Colorizer not replace a field with other text in it.
# This is useful for multi-Kanji words; once you've deleted everything but the first Kanji, you want
# the colorizer to leave the field alone.
# 1) Look for the line that starts with `def addKanji(note, flag=False, currentFieldIndex=None)`
# 2) Scroll down almost to the bottom of that function (where the lines are indented,
# right above the "Add a colorized..." bit of text
# 3) Replace this line:
note[dstField] = dst
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
dependencies:
pre:
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
- wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install rethinkdb=1.16.3~0precise
- sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
- sudo /etc/init.d/rethinkdb restart
diff --git a/ob-core.el b/ob-core-old.el
index ba82d88..a6ffcc4 100644
--- a/ob-core.el
+++ b/ob-core-old.el
@@ -1368,14 +1368,7 @@ specified in the properties of the current outline entry."
(or body "")))))
(preserve-indentation (or org-src-preserve-indentation
(save-match-data
- (string-match "-i\\>" switches))))
- (header-args (apply #'org-babel-merge-params
@sritchie
sritchie / distinctg.hs
Created April 9, 2015 15:43
State Transformer over Optional Transformer over Logger...
-- | Remove all duplicate integers from a list. Produce a log as you go.
-- If there is an element above 100, then abort the entire computation and produce no result.
-- However, always keep a log. If you abort the computation, produce a log with the value,
-- "aborting > 100: " followed by the value that caused it.
-- If you see an even number, produce a log message, "even number: " followed by the even number.
-- Other numbers produce no log message.
--
-- /Tip:/ Use `filtering` and `StateT over (`OptionalT` over `Logger` with a @Data.Set#Set@).
--
-- >>> distinctG $ listh [1,2,3,2,6]
@sritchie
sritchie / emacs.el
Created April 9, 2015 01:59
add this to your .emacs to get nice indenting for Om methods (as defined by om-tools).
(defvar om-methods
(list 'render
'render-state
'init-state
'will-mount
'should-update
'will-receive-props
'will-update
'display-name
'will-unmount)