Skip to content

Instantly share code, notes, and snippets.

View mcs07's full-sized avatar

Matt Swain mcs07

View GitHub Profile
@mcs07
mcs07 / indigo-depict-1.2.1.diff
Created January 2, 2016 16:56
Fix indigo-depict link flags
diff --git a/utils/indigo-depict/CMakeLists.txt b/utils/indigo-depict/CMakeLists.txt
index ac7e6ec..34ae32d 100644
--- a/utils/indigo-depict/CMakeLists.txt
+++ b/utils/indigo-depict/CMakeLists.txt
@@ -4,6 +4,7 @@ project(IndigoDepict)
include(DefineTest)
include_directories(../../api ../../api/plugins/renderer ../../common)
+include_directories(${IndigoRenderer_SOURCE_DIR} ${Indigo_SOURCE_DIR} ${Indigo_SOURCE_DIR}/src ${Cairo_SOURCE_DIR} ${Common_SOURCE_DIR} ${Common_SOURCE_DIR}/..)
@mcs07
mcs07 / osra-makefile.diff
Created January 3, 2016 14:17
Remove Makefile.dep from OSRA makefile so it compiles without java
diff --git a/src/Makefile b/src/Makefile
index 031a499..3ba2de7 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,6 @@
#
include ../Makefile.inc
-include Makefile.dep

Download:

cd /opt
wget https://github.com/rdkit/rdkit/archive/Release_2015_09_2.tar.gz
tar -xvf Release_2015_09_2.tar.gz
mv rdkit-Release_2015_09_2 rdkit_2015_09_2

Setup environment:

cd /opt/rdkit_2015_09_2

@mcs07
mcs07 / osra-adaptiveThreshold.diff
Created January 2, 2016 20:47
Fix OSRA use of graphicsmagick adaptiveThreshold to avoid ambiguous error
diff --git a/src/osra_grayscale.cpp b/src/osra_grayscale.cpp
index 32816ed..1b819d1 100644
--- a/src/osra_grayscale.cpp
+++ b/src/osra_grayscale.cpp
@@ -266,12 +266,12 @@ bool convert_to_gray(Image &image, bool invert, bool adaptive, bool verbose)
image.despeckle();
if (invert)
{
- image.adaptiveThreshold(window,window,7);
+ image.adaptiveThreshold(window,window,7.0);
@mcs07
mcs07 / boost-1.60.diff
Created April 21, 2016 18:22
Fix auto-pointer registration in Boost Python 1.60 from https://github.com/boostorg/python/pull/59
diff --git a/boost/python/object/class_metadata.hpp b/boost/python/object/class_metadata.hpp
index c71cf67..5009c17 100644
--- a/boost/python/object/class_metadata.hpp
+++ b/boost/python/object/class_metadata.hpp
@@ -164,7 +164,7 @@ struct class_metadata
>::type held_type;
// Determine if the object will be held by value
- typedef is_convertible<held_type*,T*> use_value_holder;
+ typedef mpl::bool_<is_convertible<held_type*,T*>::value> use_value_holder;
@mcs07
mcs07 / customwriter.cpp
Last active August 10, 2016 10:53
A custom writer class for JsonCpp that allows more control over the output formatting of the JSON. Allows custom indenting, custom line wrap width, and custom whitespace around brackets, colons and commas.
/**********************************************************************
Copyright (c) 2013 by Matt Swain <m.swain@me.com>
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mcs07
mcs07 / osra_lib.patch
Created March 5, 2017 14:46
Patch osra lib v2.1.0
diff --git a/src/osra_lib.cpp b/src/osra_lib.cpp
index 4262e83..48979ae 100644
--- a/src/osra_lib.cpp
+++ b/src/osra_lib.cpp
@@ -635,7 +635,7 @@ int osra_process_image(
if (type.empty() || type == "PDF" || type == "PS")
{
#ifdef OSRA_LIB
- poppler_doc = load_from_raw_data(image_data, image_length);
+ poppler_doc = poppler::document::load_from_raw_data(image_data, image_length);
@mcs07
mcs07 / backup_db.py
Last active August 14, 2019 20:50
Simple versioned backups for MongoDB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Save versioned backups of collections in MongoDB. Quick and dirty. """
import datetime
import shutil
import os
import subprocess
import zipfile
@mcs07
mcs07 / tautomer.py
Created April 3, 2014 15:20
Rough first go at tautomer enumeration and canonicalization using RDKit in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
from itertools import tee, izip
import logging
from rdkit import Chem
from rdkit.Chem.rdchem import BondType, BondStereo, BondDir
__author__ = 'Matt Swain'
@mcs07
mcs07 / inchi-osx.diff
Last active July 4, 2022 13:08
A patch for the InChI 1.04 makefile to support Mac OS X. This is needed because the OS X linker does not support `soname` or `version-script`.
diff --git a/INCHI_API/gcc_so_makefile/libinchi.map b/INCHI_API/gcc_so_makefile/libinchi.map
index 0526992..0f768c8 100755
--- a/INCHI_API/gcc_so_makefile/libinchi.map
+++ b/INCHI_API/gcc_so_makefile/libinchi.map
@@ -1,5 +1,32 @@
-{
-global: CheckINCHI; CheckINCHIKey; FreeINCHI; FreeStdINCHI; FreeStructFromINCHI; FreeStructFromStdINCHI; Free_inchi_Input; Free_std_inchi_Input; GetINCHI; GetINCHIKeyFromINCHI; GetINCHIfromINCHI; GetStdINCHI; GetStdINCHIKeyFromStdINCHI; GetStringLength; GetStructFromINCHI; GetStructFromStdINCHI; Get_inchi_Input_FromAuxInfo; Get_std_inchi_Input_FromAuxInfo; INCHIGEN_Create; INCHIGEN_Destroy; INCHIGEN_DoCanonicalization; INCHIGEN_DoNormalization; INCHIGEN_DoSerialization; INCHIGEN_Reset; INCHIGEN_Setup; STDINCHIGEN_Create; STDINCHIGEN_Destroy; STDINCHIGEN_DoCanonicalization; STDINCHIGEN_DoNormalization; STDINCHIGEN_DoSerialization; STDINCHIGEN_Reset; STDINCHIGEN_Setup;
-local: *;
-};
-