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 / pentadactyl-patch.diff
Created November 19, 2014 23:34
Pentadactyl patch. Added default search string feature. Press F1 to search buildwith.com on current website. Restored C-v for paste (swapped with C-t)
diff -r cef5557669dc -r 1f3bfd78d908 common/content/bookmarks.js
--- a/common/content/bookmarks.js Sat Aug 02 21:25:32 2014 -0700
+++ b/common/content/bookmarks.js Thu Nov 20 12:20:02 2014 +1300
@@ -650,6 +650,10 @@
}
});
+ options.add(["defsearchtext", "ds"],
+ "The default search query",
+ "string", "", {});
@mullikine
mullikine / organise_trigs.py
Created November 22, 2014 11:22
For use in conjunction with AOK Trigger Studio. This program reorders the execution of a scenarios triggers using XML produced by aokts.
import xml.etree.ElementTree as ET
import sys, getopt
# Author: Shane Mulligan
# 13 April 2014
# This program reorders the execution of a scenarios triggers
# to match their display orders.
def main(argv):
@mullikine
mullikine / makesmsg.sh
Last active August 29, 2015 14:19
Create self-decrypting encrypted files using your ssh public key. The self decrypting file will only decrypt if you have the private key. Only works on small files like short messages.
#!/bin/bash
if [[ "$#" == 1 ]]; then
PUBKEYFILE="${HOME}/.ssh/id_rsa.pub"
INFILE="$1"
OUTFILE="${1}.sh"
elif [[ "$#" == 2 ]]; then
PUBKEYFILE="${HOME}/.ssh/id_rsa.pub"
INFILE="$1"
OUTFILE="$2"
@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 / scratchFlZM75.txt
Created October 15, 2019 23:19
ead cl-platform
./cl-start-pf-monitoring:7:tm-restart-command -c -E "cl-platform $platform_target; cl-reset-hosts; sudo kubefwd services -n monitoring"
./start-dev-platform:30:# cl-platform dev-paas
./start-dev-platform:31:# cl-platform dev-staging
./start-dev-platform:41:cl-platform "$platform"
./cl-rm-cert:4:platform="$(cl-platform)"
./clq:10: cl-platform
./clq:98: platform="$(cl-platform)"
./clq:117: platform="$(cl-platform)"
./cl-query:10: cl-platform
./cl-query:98: platform="$(cl-platform)"
@mullikine
mullikine / my-spacemacs.el
Created October 16, 2019 13:06
eshell-unique
(defun eshell-unique (&optional arg)
(interactive "P")
(progn
(eshell arg)
;; (rename-buffer "*eshell*" t ;; (concat "*eshell-" (substring (uuidgen-4) 0 8) "*")
;; )
(rename-buffer (concat "*eshell-" (substring (uuidgen-4) 0 8) "*")
)))