Skip to content

Instantly share code, notes, and snippets.

View mikeoconnor0308's full-sized avatar

Mike O'Connor mikeoconnor0308

  • Bristol, United Kingdom
View GitHub Profile
@mikeoconnor0308
mikeoconnor0308 / bxd_impulse_constraint.py
Last active November 29, 2018 17:08
BXD Impulse Constraint Example
""""
ABC constraint demonstration under both euler and velocity verlet integration.
Bond forces are simulated using the MM3 force field, no other forces are used.
"""
import numpy as np
import matplotlib.pyplot as plt
import math
from collections import namedtuple
import seaborn as sns
@mikeoconnor0308
mikeoconnor0308 / predict_dnn.py
Last active August 7, 2019 13:35
Predict Input Function for DNNClassifier using Numeric Features
# for use with https://github.com/marcsto/rl/blob/master/src/fast_predict2.py
# feature labels that were used to train the network.
FEATURES = ['Quat_x', 'Quat_y', 'Quat_z', 'Quat_w']
def generator_evaluation_fn(generator):
""" Input function for numeric feature columns using the generator. """
def _inner_input_fn():
# set datatypes according to your data.
datatypes = tuple(len(FEATURES) * [tf.float32]
//Based on the great write-up and python code here: https://rajeshrinet.github.io/blog/2014/ising-model/
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT_Macros.h>
#include <Adafruit_SPITFT.h>
#include <gfxfont.h>
#include <Wire.h>
Adafruit_BicolorMatrix ledMatrix = Adafruit_BicolorMatrix();
@mikeoconnor0308
mikeoconnor0308 / Program.cs
Created February 20, 2018 17:08
Example API For Forcefield from Nano Simbox
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace NanoSimboxPluginExampleCSharp
{
/// <summary>
@mikeoconnor0308
mikeoconnor0308 / gimp_grayscale_batch.py
Last active January 15, 2018 13:21
GIMP Pythonfu batch grayscale and sepia toning
import glob
from gimpfu import *
dir = "path/to/images"
for fname in glob.glob(dir + "/*.xcf"):
img = pdb.gimp_file_load(fname, fname)
layer = pdb.gimp_image_merge_visible_layers(img, CLIP_TO_IMAGE)
# converts to grayscale
pdb.gimp_desaturate_full(layer, DESATURATE_LIGHTNESS)
new_name = fname[:-4] + ".png"
pdb.gimp_file_save(img, layer, new_name, new_name)
@mikeoconnor0308
mikeoconnor0308 / test_freeze_graph_extended.py
Last active October 18, 2017 15:55
Output a single tensorflow GraphDef with graph and variables.
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,