Skip to content

Instantly share code, notes, and snippets.

jiahao /
Created Jan 4, 2012
Pure Python implementation of some numerical optimizers
#!/usr/bin/env python
Pure Python implementation of some numerical optimizers
Created on Jan 21, 2011
@author Jiahao Chen
Flexi23 / gist:1713774
Created Jan 31, 2012
GLSL 2D vector buffer in a texture with a custom floating point precision
View gist:1713774
These are the helper functions to store and to restore a 2D vector with a custom 16 floating point precision in a texture.
The 16 bit are used as follows: 1 bit is for the sign, 4 bits are used for the exponent, the remaining 11 bit are for the mantissa.
The exponent bias is asymmetric so that the maximum representable number is 2047 (and bigger numbers will be cut)
the accuracy from 1024 - 2047 is one integer
512-1023 it's 1/2 int
256-511 it's 1/4 int and so forth...
between 0 and 1/16 the accuracy is the highest with 1/2048 (which makes 1/32768 the minimum representable number)
ljos /
Last active Mar 22, 2020
Showing how to listen to all keypresses in OS X through the Cocoa API using Python and PyObjC
#!/usr/bin/env python
# Copyright © 2016 Bjarte Johansen <>
# The MIT License (MIT)
# 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
indragiek / SNRRestorationManager.h
Created Aug 19, 2012
Simple Cocoa state restoration
View SNRRestorationManager.h
// SNRRestorationManager.h
// Sonora
// Created by Indragie Karunaratne on 2012-08-19.
#import <Foundation/Foundation.h>
@protocol SNRRestorableState <NSObject>
iburlakov / CFDictionaryGetValueIfPresent_Sample.c
Created Sep 27, 2012
Using of CFDictionaryGetValueIfPresent
View CFDictionaryGetValueIfPresent_Sample.c
CFDictionaryRef dict;
Get some dictionary...
SInt32 intVal = 0;
CFNumberRef cfIntVal;
char* strVal;
CFStringRef cfStrVal;
rlogiacco / receiver.ino
Last active Nov 6, 2020
nRF24 multiple transmitters
View receiver.ino
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int senderId;
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
//Contacts from the radio to connect NRF24L01 pinamnam -> Arduino
neubig /
Last active Aug 23, 2017
This is a minimal implementation of training for a language model using long short-term memory (LSTM) neural networks
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a simplified implementation of the LSTM language model (by Graham Neubig)
# LSTM Neural Networks for Language Modeling
# Martin Sundermeyer, Ralf Schlüter, Hermann Ney
# InterSpeech 2012
# The structure of the model is extremely simple. At every time step we
brigand / babel-ast-literal.js
Last active Mar 16, 2017
babel ast literals
View babel-ast-literal.js
var proxyIdentCounter = 0;
// matches ast`anything here`
var IDENTIFIER_NAME = "ast";
module.exports = function (babel) {
var babelParse = require('babel-core').parse;
// temporary