Skip to content

Instantly share code, notes, and snippets.

View Seanny123's full-sized avatar
💭
>.<

Sean Aubin Seanny123

💭
>.<
View GitHub Profile
.PHONY: run
export JULIA_PROJECT = $(PWD)
JULIA = julia
JULIAC_PATH = $(shell $(JULIA) --startup-file=no -E 'normpath(Base.find_package("PackageCompiler"), "..", "..", "juliac.jl")')
RUN_JULIAC = $(JULIA) $(JULIAC_PATH)
run: builddir/test.so
python test.py
@wonderbeyond
wonderbeyond / install-rdkit-ubuntu-build-from-source.md
Last active December 4, 2020 18:50
Install RDKit with non-standard python location, visible from a virtualenv.
@ipan
ipan / diff-jq.md
Created January 16, 2018 04:47
compare two JSONs with jq #json #jq
@abaybektursun
abaybektursun / blog_tensorflow_variable_sequence_classification.py
Last active September 6, 2019 09:26 — forked from danijar/blog_tensorflow_variable_sequence_classification.py
TensorFlow Variable-Length Sequence Classification (Updated)
# Updated to work with TF 1.4
# Working example for my blog post at:
# http://danijar.com/variable-sequence-lengths-in-tensorflow/
import functools
import sets
import tensorflow as tf
from tensorflow import nn
def lazy_property(function):
@zsunberg
zsunberg / create_points.py
Created November 28, 2017 18:38
PyJulia Example Use Case
import numpy as np
r = np.arange(1.0, 11.0, 0.1)
n = len(r)**3
pts = np.empty((n, 3))
i = 0
for x in r:
for y in r:
for z in r:
from keras.layers import Input, Dense, Lambda
from keras.models import Model
def eucl_dist(inputs):
x, y = inputs
return ((x - y)**2).sum(axis=-1)
x = Input((32,))
y1 = Dense(8)(x)
y2 = Dense(8)(x)
@gabrieleangeletti
gabrieleangeletti / rbm_after_refactor.py
Last active July 27, 2021 14:32
Restricted Boltzmann Machine implementation in TensorFlow, before and after code refactoring. Blog post: http://blackecho.github.io/blog/programming/2016/02/21/refactoring-rbm-tensor-flow-implementation.html
import tensorflow as tf
import numpy as np
import os
import zconfig
import utils
class RBM(object):
@seanjensengrey
seanjensengrey / rust-python-cffi.md
Last active April 3, 2024 11:55
Calling Rust from Python/PyPy using CFFI (C Foreign Function Interface)

This is a small demo of how to create a library in Rust and call it from Python (both CPython and PyPy) using the CFFI instead of ctypes.

Based on http://harkablog.com/calling-rust-from-c-and-python.html (dead) which used ctypes

CFFI is nice because:

  • Reads C declarations (parses headers)
  • Works in both CPython and PyPy (included with PyPy)
  • Lower call overhead than ctypes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% University Assignment Title Page
% LaTeX Template
% Version 1.0 (27/12/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% WikiBooks (http://en.wikibooks.org/wiki/LaTeX/Title_Creation)
@renaud
renaud / tornado_continuous_reload.py
Created April 10, 2014 08:35
Example of Tornado that autoreloads/watches all files in folder 'static'
'''
Example of Tornado that autoreloads/watches all files in folder 'static'
'''
import tornado.ioloop
import tornado.web
import tornado.autoreload
import os
''' serves index.html'''