Skip to content

Instantly share code, notes, and snippets.

Matthijs Hollemans hollance

Block or report user

Report or block hollance

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View convert_weights.py
# 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")
@hollance
hollance / Compressing-MobileNet.ipynb
Created Sep 26, 2017
Jupyter notebook for compressing MobileNet (work in progress)
View Compressing-MobileNet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Shaders.metal
#include <metal_stdlib>
using namespace metal;
struct Relu6Params {
float a;
};
kernel void relu6(
texture2d_array<half, access::read> inTexture [[texture(0)]],
texture2d_array<half, access::write> outTexture [[texture(1)]],
View Sketch.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hollance
hollance / deconv.py
Created May 13, 2017
Playing with "deconvolution"
View deconv.py
import numpy as np
i = np.array(list(range(1, 50)), dtype=np.float).reshape((7, 7))
k = np.array(list(range(1, 10)), dtype=np.float).reshape((3, 3))
print("Input:"); print(i)
print("Kernel:"); print(k)
# Forward convolution. We need to pad the input so that we can read from
# its borders. (Not doing stride etc here.)
@hollance
hollance / XOR.swift
Created Jan 11, 2017
Playing with BNNS (Swift version). The "hello world" of neural networks.
View XOR.swift
/*
The "hello world" of neural networks: a simple 3-layer feed-forward
network that implements an XOR logic gate.
The first layer is the input layer. It has two neurons a and b, which
are the two inputs to the XOR gate.
The middle layer is the hidden layer. This has two neurons h1, h2 that
will learn what it means to be an XOR gate.
@hollance
hollance / recursive-descent.swift
Created Dec 28, 2016
Simple recursive descent parser
View recursive-descent.swift
import Cocoa
let input = "15,7, 3 ,, [1,2,[3, 4, 5], 6],8"
//let input = "5,7,[1]"
var index = input.characters.startIndex
var lookahead = input[index]
var done = false
func eat() {
@hollance
hollance / eliza.swift
Last active Jul 3, 2019
The classic ELIZA chat bot in Swift.
View eliza.swift
/*
Joseph Weizenbaum's classic ELIZA chat bot in Swift.
Based on the IBM PC BASIC program from CREATIVE COMPUTING by Patricia
Danielson and Paul Hashfield, and the Java adaptation by Jesper Juul.
Run this script from Terminal:
$ swift eliza.swift
Press Ctrl-C or Ctrl-D to quit. (Or type "shut up".)
@hollance
hollance / ZeroGravity.asm
Created Nov 23, 2016
Zero Gravity source code (Amiga 1200)
View ZeroGravity.asm
; *****************************************************************************
;
; $VER: ZeroGravity Source 1.0 (C) 1997 Matthijs Hollemans
;
; *****************************************************************************
;
; This is the full source code to Zero Gravity. I used the very cool ASM-One
; V1.29 assembler from T.F.A. but that doesn't matter anyway because you won't
; be able to reassemble this without the required binary includes...
;
@hollance
hollance / Evil Insects.txt
Created Nov 23, 2016
Really old source code
View Evil Insects.txt
; ** START OF BLITZ 2 SOURCE **
; EVIL INSECTS
; ============
; Last changed: 30-06-94 (still 45 days and then...I'm 18)
; Author: Matthijs Hollemans
; This is the CHEATMODE, type it in correctly and you will be
; given 9 lives!
;
You can’t perform that action at this time.