Skip to content

Instantly share code, notes, and snippets.


Johan gustafsson

View GitHub Profile
gustafsson / pg-pong.jl
Created Feb 23, 2019 — forked from karpathy/
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
View pg-pong.jl
# Translation of @karpathy's from Python to Julia
# Note that it takes several days to learn a policy that wins most games.
# Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym through Gym.jl and PyCall.jl.
using Gym
using Serialization
using StatsBase: mean, std
# hyperparameters
#!/usr/bin/env sh
# Creates a watchdog file WATCHDOG and executes CHILDAPP WATCHDOG.
# If CHILDAPP exits it is restarted.
# If CHILDAPP does not touch WATCHDOG within TIMEOUT seconds it is killed and restarted.
# This script stops CHILDAPP when it is aborted (Ctrl-C or SIGTERM).
set -e # abort this script if anything fails
gustafsson / numeric_palindromes.m
Last active Aug 29, 2015
Number of numeric palindromes in different bases
View numeric_palindromes.m
%% Number of numeric palindromes in different bases
N = zeros(4096,36);
for i=2:size(N,1)
N(i,:) = N(i-1,:);
for b=2:size(N,2)
s = dec2base(i,b);
if all(s == fliplr(s))
N(i,b) = N(i,b) + 1;
gustafsson / .gitignore
Created Jun 25, 2013
A .gitignore for Unity Projects. Worked for us. Might completely break your project. To remove previously tracked but now ignored files, run (from a clean working directory): git rm -r --cached .; git add .
View .gitignore
gustafsson / freqtime.m
Created May 31, 2012
Illustration of sinusoid in time and frequency domain (Octave script)
View freqtime.m
function freqtime(f)
% The fourier transform below assumes that y is a periodic signal which it is if 'f' is an integer (i.e we don't do any windowing)
if 0==nargin
f = 2;
A = 1;
View gist:367790
int MicrophoneRecorder::
writeBuffer(const void *inputBuffer,
void */*outputBuffer*/,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo */*timeInfo*/,
PaStreamCallbackFlags /*statusFlags*/)
BOOST_ASSERT( inputBuffer );
const float **in = (const float **)inputBuffer;
const float *buffer = in[0];
View gist:301498
Här är ett exempel på hur man kan hantera textdokument med git i en webbläsare.
Man behöver inget konto för att skapa en gist eller redigera den.
You can’t perform that action at this time.