Skip to content

Instantly share code, notes, and snippets.

hacking the mainframe

Mark Watson markwatson

hacking the mainframe
View GitHub Profile
sirikon /
Last active Jun 30, 2022
task file in Python 3
#!/usr/bin/env python3
def cli():
def hello(*args):
cmd('echo', 'Hello', *args)
lucasrcosta /
Last active Oct 26, 2021
AWS Lambda Python Runtime
# -*- coding: utf-8 -*-
# /var/runtime/awslambda/
Amazon Lambda
Copyright (c) 2013 Amazon. All rights reserved.
Lambda runtime implemention
niranjv /
Last active Jul 28, 2022
Change Python logger format in AWS Lambda
# Python logger in AWS Lambda has a preset format. To change the format of the logging statement,
# remove the logging handler & add a new handler with the required format
import logging
import sys
def setup_logging():
logger = logging.getLogger()
for h in logger.handlers:
jgdavey / trace_paths.clj
Created Mar 4, 2014
How to get paths for map of sets?
View trace_paths.clj
(use 'clojure.test)
(deftest tracing-paths
(testing "trace-paths"
(is (= (trace-paths {:a nil} :a)
(is (= (trace-paths {:a #{:b}
:b nil} :a)
# Too many crusty old git branches? Run this to find likely candidates for deletion
# It lists all the remote branches and sorts them by age.
# Folks at pivotal shared this with me
#$ .
# 2012-05-04 09:42:29 -0700 4 minutes ago Ted & Bill \torigin/hey_Bill
hrldcpr /
Last active Aug 10, 2022
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

markwatson / AdjacencyMatrix
Created Mar 2, 2011
Not finished just saving it here...
View AdjacencyMatrix
class AdjacencyMatrix[T: Manifest](size: Int) {
// initialize it
// (It's in column vector format)
val matrix = Array.ofDim[T](size, size)
// helper functions
// takes a list of 3-tuples in the form: (from, to, weight)
def setConnections(connections: List[(Int, Int, T)]) = {
for (x <- connections) {
// make matrix[to][from] = weight