This file contains hidden or 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
deco <- function(f) { | |
wrapper <- function(...) { | |
# <code prior to execution> | |
res <- f(...) | |
# <code after execution> | |
return(res) | |
} |
This file contains hidden or 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 gist reproduces the algorithm available at: | |
# http://mnemstudio.org/path-finding-q-learning-tutorial.htm | |
import numpy as np | |
import random | |
## Initialize q-table | |
Nstates = 6 | |
Nactions = 6 | |
Q = np.zeros((Nstates, Nactions)) |
This file contains hidden or 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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
This file contains hidden or 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
%% Encrypt with chaos | |
% An easy version of the method for using chaos to encrypt an audio message | |
% described in Strogatz's Nonlinear dynamics and chaos, 1994 | |
% | |
% More information at: <http://mappingignorance.org/2016/05/09/the-sound-of-chaos/> | |
%% Load the original sound | |
load handel; | |
sampling_freq = Fs; |
This file contains hidden or 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
%% Hearing chaos | |
% How chaos sounds? In this script we will create a chaotic time series and | |
% translate it to a sound signal | |
% | |
% More information at: <http://mappingignorance.org/2016/05/09/the-sound-of-chaos/> | |
%% Harvest chaos from the Lorenz equation | |
% The Lorenz equation is the classical example of deterministic dynamical | |
% system giving rise to chaos. The equation reads: | |
% |
This file contains hidden or 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
clap = audioread('clap.wav'); | |
fs = 96e3; % sampling frequency | |
N = 40; % steps | |
ssize = 0.15; % step size | |
delay = ssize * 2 / 340; | |
samples = round(delay * fs); | |
stairs = zeros(samples * N + length(clap) + N, N); | |
for i = 1:N | |
samples = samples + 1; | |
indexes = (i-1)*samples+1 : length(clap)+(i-1)*samples; |