Skip to content

Instantly share code, notes, and snippets.

View patricksnape's full-sized avatar

Patrick Snape patricksnape

View GitHub Profile
@romannurik
romannurik / background-page.html
Created September 24, 2009 05:15
A workaround for Cross-domain XHR's not working in Chrome Extensions' content scripts. See http://groups.google.com/group/chromium-extensions/browse_thread/thread/43ec4d383cf8d01d
<!DOCTYPE html>
<html>
<head>
<script src="xhrproxy.js"></script>
<script>
setupXHRProxy();
</script>
</head>
@imakewebthings
imakewebthings / gist:1216527
Created September 14, 2011 13:20
Extended Slide Events
(function($, deck, undefined) {
$(document).bind('deck.change', function(e, from, to) {
var $prev = $[deck]('getSlide', to-1),
$next = $[deck]('getSlide', to+1);
$[deck]('getSlide', to).trigger('deck.becameCurrent');
$prev && $prev.trigger('deck.becamePrevious');
$next && $next.trigger('deck.becameNext');
});
})(jQuery, 'deck');
@gordonbrander
gordonbrander / LiveCollection.js
Created December 27, 2011 19:40
Backbone Live Collections w/ Streaming and Automatic Duplicate Handling
var LiveCollection = (function (_, Backbone) {
var Collection = Backbone.Collection;
// Define a Backbone Collection handling the details of running a "live"
// collection. Live collections are expected to handle fetching their own
// data, rather than being composed from separate models.
// They typically add new models instead of resetting the collection.
// A custom add comparison makes sure that duplicate models are not
// added. End result: only new elements will be added, instead
// of redrawing the whole collection.
//
@osdf
osdf / test_numpy.py
Created October 5, 2012 21:27
Testing numpy and scipy setups
#!/usr/bin/env python
import numpy
import sys
import timeit
try:
import numpy.core._dotblas
print 'FAST BLAS'
except ImportError:
print 'slow blas'
@gsakkis
gsakkis / render_query.py
Created January 19, 2013 11:25
Generate an SQL expression string with bound parameters rendered inline for the given SQLAlchemy statement.
from datetime import datetime, date
from sqlalchemy.orm.query import Query
def render_query(statement, bind=None):
"""
Generate an SQL expression string with bound parameters rendered inline
for the given SQLAlchemy statement.
WARNING: This method of escaping is insecure, incomplete, and for debugging
purposes only. Executing SQL statements with inline-rendered user values is
@certik
certik / compile_run.sh
Last active February 23, 2023 22:50
Test offscreen rendering with VTK 6
#! /bin/bash
set -e
g++ -o test_offscreen.o -c test_offscreen.cpp -I$PYTHONHPC/include/vtk-6.0
g++ -o test_offscreen test_offscreen.o $PYTHONHPC/lib/libvtk*.so
LD_LIBRARY_PATH=$PYTHONHPC/lib/ ./test_offscreen
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EncodeTS
EncodeTS / keras VGG-Face Model.md
Last active February 19, 2024 06:56
VGG-Face model for keras

VGG-Face model for Keras

This is the Keras model of VGG-Face.

It has been obtained through the following method:

  • vgg-face-keras:directly convert the vgg-face matconvnet model to keras model
  • vgg-face-keras-fc:first convert vgg-face caffe model to mxnet model,and then convert it to keras model

Details about the network architecture can be found in the following paper:

@hollance
hollance / convert_weights.py
Created October 7, 2017 20:43
SE-ResNet-50 in Keras
# Convert SE-ResNet-50 from Caffe to Keras
# Using the model from https://github.com/shicai/SENet-Caffe
import os
import numpy as np
# The caffe module needs to be on the Python path; we'll add it here explicitly.
import sys
caffe_root = "/path/to/caffe"
sys.path.insert(0, caffe_root + "python")
@smitshilu
smitshilu / Tensorflow_Build_GPU.md
Last active June 9, 2020 18:27
Tensorflow 1.4 Mac OS High Sierra 10.13 GPU Support

Tensorflow

System information

  • OS - High Sierra 10.13
  • Tensorflow - 1.4
  • Xcode command line tools - 8.2 (Download from here: Xcode - Support - Apple Developer & Switch to different clang version: sudo xcode-select --switch/Library/Developer/CommandLineTools & check version: clang -v)
  • Cmake - 3.7
  • Bazel - 0.7.0