Skip to content

Instantly share code, notes, and snippets.

View ableasdale's full-sized avatar

Alex Bleasdale ableasdale

View GitHub Profile
@derms
derms / 1_convertModel.py
Last active February 29, 2020 12:49
Sample Sentiment model converted into ONNX and run in MarkLogic. Original Model : https://github.com/cocoa-ai/SentimentCoreMLDemo/blob/master/SentimentPolarity/Resources/SentimentPolarity.mlmodel
import coremltools
# Load a Core ML model
coreml_model = coremltools.utils.load_spec('SentimentPolarity.mlmodel')
# Convert the Core ML model into ONNX
onnx_model = onnxmltools.convert_coreml(coreml_model, 'Sentiment Polarity')
# Save as protobuf
onnxmltools.utils.save_model(onnx_model, 'SentimentPolarity.onnx')
@derms
derms / 1_import_onnx_model.sjs
Last active February 27, 2020 15:25
Example of using ONNX Machine Learning Models in MarkLogic 10 (10.0-4 and above). BiDAF model: https://github.com/onnx/models/tree/master/text/machine_comprehension/bidirectional_attention_flow.
'use strict';
// Simple way to download the model and insert it into the database.
// Normally would use a tool like mlcp to do this. This only needs to be done once
declareUpdate()
//downloads the BiDAF model
let model = fn.subsequence(
xdmp.httpGet("https://onnxzoo.blob.core.windows.net/models/opset_9/bidaf/bidaf.onnx")
, 2, 1)
//inserts the BiDAF model into the database at the URI /onnx/model/bidaf.onnx
@grtjn
grtjn / fluent-node-builder.sjs
Last active May 21, 2021 14:32
Fluent interface for MarkLogic NodeBuilder
'use strict';
// Fluent interface functions
function document(root) {
return function(b) {
return (b || new NodeBuilder()).addDocument(root);
}
}

How Do I Into Git?

a helpful primer for users sick of git's poorly-named commands

I've used Git since 2011, and this is the stuff that I've always had to Google to remember. I hope it helps you not hate Git so much.

Learning About the Repo

Learning About History

@DALDEI
DALDEI / cfvalidate
Last active October 29, 2015 14:59
AWS-CLI Cloud Formation Validation
#!/bin/sh
#############################################################################
## Usage: cfvalidate file.template [ file ...]
##############################################################################
## Convenience wrapper script for aws cli 'cloudformation validate-template'
## which requires a inline, file URL or S3 url for templates to validate
## This script takes simple, absolute or relative filenames and validate them
## using the AWS API
## https://aws.amazon.com/cli/
##
@jtpaasch
jtpaasch / cli.py
Last active July 17, 2016 12:13
Helps build command line tools in Python.
# -*- coding: utf-8 -*-
"""A simple tool for making command line tools in python."""
import os
import sys
class CLI(object):
@jtpaasch
jtpaasch / amazonctl.py
Created October 26, 2015 12:47
A collection of functions commonly used to do AWS stuff.
# -*- coding: utf-8 -*-
"""A simple tool to document how to control AWS resources.
AWS AUTHENTICATION
-------------------
In order to run any of the code below, you need a profile with AWS credentials
set up on your computer. It's very easy to do this. Google how to configure
your profile with boto3, or visit the docs:
@iMilnb
iMilnb / boto3_hands_on.md
Last active October 19, 2022 09:15
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
@iMilnb
iMilnb / ec2.py
Created May 27, 2015 12:29
AWS EC2 simple manipulation script using python and boto3
#!/usr/bin/env python
# Simple [boto3](https://github.com/boto/boto3) based EC2 manipulation tool
#
# To start an instance, create a yaml file with the following format:
#
# frankfurt:
# - subnet-azb:
# - type: t2.micro
# image: image-tagname
@marianposaceanu
marianposaceanu / linux_performance.md
Last active January 30, 2024 06:47
Linux simple performance tweaks

Linux simple performance tweaks

Change the I/O Scheduler

Open $ vim /etc/default/grub then add elevator=noop next to GRUB_CMDLINE_LINUX_DEFAULT. Run $ update-grub and $ cat /sys/block/sda/queue/scheduler to be sure that noop is being used:

$ vim /etc/default/grub
$ update-grub
$ cat /sys/block/sda/queue/scheduler

[noop] deadline cfq