Skip to content

Instantly share code, notes, and snippets.

View mullikine's full-sized avatar
🍓

Shane Mulligan mullikine

🍓
  • Dunedin, NZ
View GitHub Profile
@mullikine
mullikine / el7check.hs
Created April 25, 2019 11:50 — forked from juhp/el7check.hs
haskell turtle shell script to check NVRs of epel7 packages
{-# LANGUAGE OverloadedStrings #-}
import Turtle
import Data.Text (words)
rpmspecSrc qf spec = do
(_res, out) <- procStrict "rpmspec" ["-q", "--srpm", "--undefine=dist", "--qf", qf, spec] empty
return out
nvr = "%{name}-%{version}-%{release}"
@mullikine
mullikine / binary_tree_1.scm
Created April 27, 2019 01:36 — forked from zallarak/binary_tree_1.scm
Binary trees in Scheme
; sets as unordered lists:
; a set for now is defined as as being able
; to undergo the following operations
; 1) element-of-set? checks if x is in set
(define (element-of-set? x set)
(cond ((null? set) false)
((equal? x (car set)) true)
(else (element-of-set? x (cdr set)))))
@mullikine
mullikine / rbtree.lisp
Created May 5, 2019 06:33 — forked from Mozk0/rbtree.lisp
Red Black Tree for Common Lisp.
;; The following implementation of rb-tree is based on http://www.cs.kent.ac.uk/people/staff/smk/redblack/.
(defun change-to-black (tree)
(pattern-match tree
((:pattern (_ . rest) :variable rest :ignore _) `(:B . ,rest))
(:otherwise nil)))
(defun rb-insert (tree obj cmp)
(change-to-black (rb-insert% tree obj cmp)))
@mullikine
mullikine / format.hs
Created May 5, 2019 06:37 — forked from Mozk0/format.hs
統合TVのネタバレスーパーを生成する。
import System.Environment (getArgs)
import Control.Monad (mapM_)
import Data.Functor ((<$>))
import Data.String.Utils (replace) -- missingH
import System.IO.UTF8 (putStrLn, readFile) -- utf8-string
import Prelude hiding (putStrLn, readFile)
main :: IO ()
main = main' =<< getArgs

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@mullikine
mullikine / bonus 1 solution
Created December 3, 2019 02:29 — forked from erantapaa/bonus 1 solution
Daily Programmer 2017-09-22 Solution
iniital board:
1 3 2 5 4 2 2 3
1 12345678 .....6.. 12345678 12345678 ....5... 12345678 1....... 12345678 3
4 12345678 .2...... 1....... 12345678 12345678 12345678 12345678 12345678 2
3 .2...... 12345678 12345678 12345678 .....6.. 12345678 ..3..... 12345678 5
3 12345678 12345678 12345678 12345678 12345678 .......8 12345678 12345678 2
2 12345678 12345678 .....6.. 12345678 12345678 ..3..... ......7. 12345678 3
2 12345678 12345678 ....5... 12345678 12345678 12345678 12345678 12345678 1
4 12345678 12345678 12345678 12345678 12345678 12345678 12345678 ..3..... 3
3 12345678 12345678 12345678 12345678 ..3..... 12345678 12345678 12345678 3
@mullikine
mullikine / from-plain-text.ipynb
Created December 4, 2019 08:12 — forked from aparrish/from-plain-text.ipynb
Semantic similarity chatbots from plain-text files ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mullikine
mullikine / predictive-models.ipynb
Created December 4, 2019 08:56 — forked from aparrish/predictive-models.ipynb
Predictive text and text generation notebook. Written for Code Societies at SFPC, summer 2018. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mullikine
mullikine / latency.txt
Created December 14, 2019 01:43 — forked from bafna/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@mullikine
mullikine / docker-help.md
Created January 26, 2020 01:52 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info