Skip to content

Instantly share code, notes, and snippets.

@brigand
brigand / babel-ast-literal.js
Last active March 16, 2017 00:19
babel ast literals
var proxyIdentCounter = 0;
// matches ast`anything here`
var IDENTIFIER_NAME = "ast";
module.exports = function (babel) {
var babelParse = require('babel-core').parse;
// temporary
@neubig
neubig / lstm-lm.py
Last active August 23, 2017 09:18
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
@rlogiacco
rlogiacco / receiver.ino
Last active December 15, 2022 23:36
nRF24 multiple transmitters
#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
@iburlakov
iburlakov / CFDictionaryGetValueIfPresent_Sample.c
Created September 27, 2012 19:18
Using of CFDictionaryGetValueIfPresent
CFDictionaryRef dict;
/*
Get some dictionary...
*/
SInt32 intVal = 0;
CFNumberRef cfIntVal;
char* strVal;
CFStringRef cfStrVal;
@indragiek
indragiek / SNRRestorationManager.h
Created August 19, 2012 20:16
Simple Cocoa state restoration
//
// SNRRestorationManager.h
// Sonora
//
// Created by Indragie Karunaratne on 2012-08-19.
//
#import <Foundation/Foundation.h>
@protocol SNRRestorableState <NSObject>
@ljos
ljos / cocoa_keypress_monitor.py
Last active January 6, 2024 07:36
Showing how to listen to all keypresses in OS X through the Cocoa API using Python and PyObjC
#!/usr/bin/env python
#
# cocoa_keypress_monitor.py
# Copyright © 2016 Bjarte Johansen <Bjarte.Johansen@gmail.com>
#
# 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
@Flexi23
Flexi23 / gist:1713774
Created January 31, 2012 23:27
GLSL 2D vector buffer in a texture with a custom floating point precision
/*
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)
@jiahao
jiahao / Optimizer.py
Created January 4, 2012 17:44
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
'''