Skip to content

Instantly share code, notes, and snippets.

multiple files!
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.
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];
@gustafsson
gustafsson / freqtime.m
Created May 31, 2012 17:00
Illustration of sinusoid in time and frequency domain (Octave script)
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;
end
A = 1;
@gustafsson
gustafsson / .gitignore
Created June 25, 2013 14:41
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 .
obj
Temp
*.suo
*.user
*.pidb
*.userprefs
*.sln
*.csproj
Library/cache
mypi
@gustafsson
gustafsson / numeric_palindromes.m
Last active August 29, 2015 14:13
Number of numeric palindromes in different bases
%% 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;
end
end
#!/usr/bin/env sh
# ./mydeamon.sh TIMEOUT CHILDAPP
#
# 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
SECONDS_UNTIL_KILL=$1
@gustafsson
gustafsson / pg-pong.jl
Created February 23, 2019 20:39 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
# Translation of @karpathy's pg-pong.py from Python to Julia
# https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e4ea32c5
# 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
@gustafsson
gustafsson / keybase.md
Last active February 23, 2021 12:56
keybase.md

Keybase proof

I hereby claim:

  • I am gustafsson on github.
  • I am jeklof (https://keybase.io/jeklof) on keybase.
  • I have a public key ASDWvgrbt_sa06wveS8xL9ugzfGB3Oo9oK_BalsegUh3rwo

To claim this, I am signing this object: