Skip to content

Instantly share code, notes, and snippets.

@andrewdyates
andrewdyates / contentstore.specification.yml
Created August 28, 2021 08:54
Promoted.ai Content Store OpenAPI 3 hml format
openapi: 3.0.1
info:
title: Promoted.ai Content Store
version: 1.0.0
description: Manage marketplace content for your Promoted.ai integration.
contact:
name: Promoted.ai
url: https://www.promoted.ai
#servers:
#- url:
alias ls='ls -G'
export CLICOLOR=1
export PS1='\[\e[0;36m\]\[\e[0;34m\]\u@\w\[\e[1;37m\]\[\e[0;37m\]$ '
alias e='emacs -nw'
# added by Anaconda3 4.4.0 installer
export PATH="/Users/k/anaconda/bin:$PATH"
alias py="source activate keras36"
alias nb="jupyter notebook"
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
(add-to-list 'package-archives (cons "melpa" url) t))
(when (< emacs-major-version 24)
#
# PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE
# Pareto/NBD (negative binomial distribution) modeling of
# repeat-buying behavior in a noncontractual setting
#
# Matthew Baggott, matt@baggott.net
#
# Accompanying slides at:
# http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1#
#
https://s3.amazonaws.com/yates2/ENGLISH.may9.2014.1ksamp1.pytxt
https://s3.amazonaws.com/yates2/ENGLISH.may9.2014.1ksamp2.pytxt
https://s3.amazonaws.com/yates2/ENGLISH.may9.2014.1ksamp3.pytxt
https://s3.amazonaws.com/yates2/ENGLISH.may9.2014.1ksamp4.pytxt
https://s3.amazonaws.com/yates2/ENGLISH.may9.2014.1ksamp5.pytxt
https://s3.amazonaws.com/yates2/FULL.may9.2014.pytxt.gz
https://s3.amazonaws.com/yates2/ENGLISH.may9.2014.pytxt.gz
https://s3.amazonaws.com/yates2/merged_attrs_apr30.pytxt.gz

The Open Access Academia Corpus

Computationally Currated Corpus of Open Access Publications from All Disciplines

  • 2,737,377 Unique Documents
  • 3,916,477 Unique Authors
  • 13,197 Journals
  • 5,187 Publishers
  • 70 Languages

Entries compiled from arXiv, PubMed OA, DOAJ, and a selection provided by OCLC.

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

#!/usr/bin/python
"""Let's solve a (same-length) jumble!
USAGE: python -i same_len_jumble.py
"""
MY_WORD_FILE = "/usr/share/dict/words"
anagrams = {}
for line in open(MY_WORD_FILE):
word = line.strip()
anagrams.setdefault("".join(sorted(word)),[]).append(word)
@andrewdyates
andrewdyates / word_jumble.py
Last active August 29, 2015 13:56
JUMBLER
#!/usr/bin/python
"""Let's solve a jumble!
"""
MY_WORD_FILE = "/usr/share/dict/words"
class Trie(object):
def __init__(self):
self.root = {}
def add(self, word):
"""Add a word to the Trie."""
@andrewdyates
andrewdyates / make_dir.py
Created October 2, 2012 22:57
A simple make directory function in Python that I must have copy-pasted 100 times.
#!/usr/bin/python
import os, errno
def make_dir(outdir):
try:
os.makedirs(outdir)
except OSError, e:
if e.errno != errno.EEXIST: raise
return outdir