Skip to content

Instantly share code, notes, and snippets.

@candlewill
candlewill / keras_models.md
Last active December 9, 2022 02:43
A collection of Various Keras Models Examples

Keras Models Examples

一系列常用模型的Keras实现

DNN

Multilayer Perceptron (MLP) for multi-class softmax classification

from keras.models import Sequential
@cormullion
cormullion / poincare.jl
Last active January 14, 2021 21:36
poincare section of chaotic network of three neurons
# most of the code is by Rainer Engelken
# updated to Julia 1.0 syntax, tested on 1.4
using Luxor, StaticArrays
# poincare section of chaotic network of three neurons
function spikingnet(n, couplingstrength=1.0)
# number of spikes in calculation
@sdumetz
sdumetz / Encoder.hpp
Created May 19, 2017 14:44
barebone C++ MPEG4/h264 video encoder using libavformat and libavcodec. Options choice is explained in https://sdumetz.github.io/2017/05/19/libav-encoding-for-ios.html
#include <stdio.h>
#include <iostream>
extern "C"{
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h> //for av_image_alloc only
#include <libavutil/opt.h>
@njbbaer
njbbaer / ca.py
Last active October 27, 2022 18:05
Fast implementation of cellular automata using 2D convolution
import time
import numpy as np
from numpy.fft import fft2, ifft2
from matplotlib import pyplot, animation
def fft_convolve2d(board, kernal):
board_ft = fft2(board)
kernal_ft = fft2(kernal)
height, width = board_ft.shape
// Reformatted version from here:
// https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4422&lngWId=3
#include <windows.h>
#include <mmsystem.h>
#include <stdio.h>
/*
* some good values for block size and count
*/
#define BLOCK_SIZE 8192
@r-lyeh-archived
r-lyeh-archived / postprocessing.glsl
Last active July 5, 2021 01:50
postprocessing effects
// Created by inigo quilez - iq/2013
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// https://www.shadertoy.com/view/4dfGzn
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 q = fragCoord.xy / iResolution.xy;
vec2 uv = vec2(q.x,q.y);
// zooming
@CMCDragonkai
CMCDragonkai / Grammar.md
Last active July 14, 2023 19:12
Haskell: Simple Predictive Parser using LL(1)

Simple Predictive Parser using LL(1)

A predictive parser is a recursive descent parser without backtracking. It relies on the concept of a lookahead symbol to determine which production rule to use. It does not support left recursion, and requires any left-recursive grammars to be converted to right recursive grammars. A predictive parser is called LL(k) where k denotes the number of lookahead symbols used. This is LL(1) because we're only using one 1 look ahead symbol equivalent to 1 character terminal in the input string. There is no lexer required, thus in this case the tokens and terminals are the exact same thing.

Strings to be parsed:

@t-mat
t-mat / minimal_vst2x_host.cpp
Last active June 7, 2024 06:22
WIN32 : Minimal VST 2.x host in C++11.
// Win32 : Minimal VST 2.x Synth host in C++11.
//
// This is a simplified version of the following project by hotwatermorning :
// A sample VST Host Application for C++ Advent Calendar 2013 5th day.
// https://github.com/hotwatermorning/VstHostDemo
//
// Usage :
// 1. Compile & Run this program.
// 2. Select your VST Synth DLL.
// 3. Press QWERTY, ZXCV, etc.
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active July 18, 2025 09:10
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-color.md
Last active August 29, 2022 15:54
GLSL color functions

RGB - YUB

mat3 yuv2rgb = mat3(1.0, 0.0, 1.28033, 1.0, -0.21482, -0.38059, 1.0, 2.12798, 0.0);
mat3 rgb2yuv = mat3(0.2126, 0.7152, 0.0722, -0.09991, -0.33609, 0.43600, 0.615, -0.5586, -0.05639);

RGB - HSV