This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Backwards difference | |
∇fᵢ = (fᵢ - fᵢ₋₁) | |
""" | |
function ∇(power, f, i) | |
if power > 1 | |
∇(power-1, f, i) - ∇(power-1, f, i-1) | |
else | |
f[i] - f[i-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require math/matrix) | |
(define (sigmoid x) (/ (exp x) (+ (exp x) 1))) | |
(define (sigmoid~ x) (* (sigmoid x) (- 1 (sigmoid x)))) | |
(define (tanh~ x) (/ 1 (expt (cosh x) 2))) | |
(define activation sigmoid) | |
(define activation~ sigmoid~) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
;; Week 1 | |
;; There are two protocols in secure communication: | |
;; - handshake protocol: finding a shared key | |
;; - record layer: sending and receiving data | |
;; | |
;; Encrypting files is the same as sending encrypted | |
;; messages between A -> B, except B is actually A in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This examples read a PNG and its palette | |
#include <png.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
int main() { | |
png_image img; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 core | |
uniform float fGlobalTime; // in seconds | |
uniform vec2 v2Resolution; // viewport resolution (in pixels) | |
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq | |
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients | |
uniform sampler1D texFFTIntegrated; // this is continually increasing | |
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// O nome da função pode ser escolhido arbitrariamente | |
// | |
// config: objeto contendo configuração estática relacionada ao fluxo; | |
// | |
// callback: função que recebe como argumento um bloco a ser adicionado | |
// ao chat e termina o estado de loading. | |
function nldAPI_JornalDoCarro_LeadComplete(config, callback) { | |
// Extrai os dados usando o objeto global "neurolead" | |
var leadData = neurolead.getData(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple, Useful and Slow | |
// Assorted Reference Statistics Functions | |
// UTF-8 Edition | |
// Shorthands | |
pow = Math.pow | |
sqrt = Math.sqrt | |
pi = Math.PI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vec_(x, y) | |
return { x = x, y = y } | |
end | |
function add(a, b) | |
return vec_(a.x+b.x, a.y+b.y) | |
end | |
function sub(a, b) | |
return vec_(a.x-b.x, a.y-b.y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { | |
expdesc e; | |
check_condition(ls, vkisvar(lh->v.k), "syntax error"); | |
if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */ | |
struct LHS_assign nv; | |
nv.prev = lh; | |
suffixedexp(ls, &nv.v); | |
if (!vkisindexed(nv.v.k)) | |
check_conflict(ls, lh, &nv.v); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cantor(x, y) { | |
return (x+y)/2*(x+y+1)+y; | |
} | |
function decantor(z) { | |
let w = Math.floor((Math.sqrt(8*z+1)-1)/2); | |
let t = (w*w+w)/2; | |
return { | |
y: z-t, |
NewerOlder