Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 13 files changed
  • 0 comments
  • 1 contributor
4 .gitignore
... ... @@ -1,3 +1,7 @@
1 1 _vim/backup/*
2 2 _vim/tmp/*
3 3 _vim/.netrwhist
  4 +_vim/backup/
  5 +_xmonad/xmonad-*
  6 +_xmonad/xmonad.o
  7 +_xmonad/xmonad.hi
3  _vim/backup/.gitignore~
... ... @@ -1,3 +0,0 @@
1   -_drafts/
2   -_site/
3   -_build/
93 _vim/backup/.vimrc~
... ... @@ -1,93 +0,0 @@
1   -set nocompatible
2   -
3   -call pathogen#infect()
4   -call pathogen#helptags()
5   -
6   -filetype plugin indent on
7   -syntax on
8   -set autoindent
9   -
10   -" map leader
11   -let mapleader=","
12   -
13   -set background=dark
14   -
15   -"colorscheme peachpuff
16   -
17   -" make backup files
18   -set backup
19   -" backup file directory
20   -set backupdir=~/.vim/backup
21   -
22   -" swap file directory
23   -set directory=~/.vim/tmp
24   -
25   -
26   -" no noise
27   -set noerrorbells
28   -
29   -" comand line completion
30   -set wildmenu
31   -" ignored files from completion
32   -set wildignore=*.o,*.obj,*.bak,*.exe,*.pyc,*.dll
33   -" type of completion list
34   -set wildmode=full
35   -
36   -
37   -" highlight current line
38   -"set cursorline
39   -
40   -" always show status line
41   -set laststatus=2
42   -
43   -" show current position
44   -set ruler
45   -
46   -" show tabs and trailing spaces
47   -set listchars=tab:>-,trail:-
48   -
49   -" line number
50   -set number
51   -" number of digits
52   -set numberwidth=4
53   -
54   -" min lines above/below
55   -set scrolloff=5
56   -
57   -" show command as typed
58   -set showcmd
59   -
60   -" show matching brackets
61   -set showmatch
62   -
63   -" tabs to spaces
64   -set expandtab
65   -" width of tab
66   -set softtabstop=4
67   -" auto indent amount
68   -set shiftwidth=4
69   -
70   -" auto insert comments
71   -set formatoptions=rq
72   -
73   -" case insensitive
74   -set ignorecase
75   -
76   -" incremental search
77   -set incsearch
78   -" highlight search results
79   -set hlsearch
80   -
81   -" no wrap by default
82   -set nowrap
83   -
84   -" Backspace
85   -set backspace=eol,start,indent
86   -set whichwrap+=<,>,h,l
87   -
88   -" hide seach results
89   -nnoremap <leader><space> :nohlsearch<cr>
90   -
91   -" show CommandT
92   -map <leader>f :CommandT<cr>
93   -
188 _vim/backup/2011-11-17-snap-framework-basics.md~
... ... @@ -1,188 +0,0 @@
1   ----
2   -layout: post
3   -title: Snap Framework Basics
4   ----
5   -
6   -{{ page.title }}
7   -================
8   -
9   -*This post is a [Work-In-Procress](http://en.wikipedia.org/wiki/Work_in_process). As I dive deeper and deeper into [Snap](http://snapframework.com/) I will keep updating this with information that I think is key to understanding Snap.*
10   -
11   -I usually develop in [Python](http://python.org/), although that has more to do with the languages look-and-feel than anything else. After almost ten years of progamming I have come to the conclusion that that is one of the most important aspects of a language. If you like [static-typing](http://en.wikipedia.org/wiki/Type_system#Static_typing) use something like Java/C#, if you don't use Python or Ruby or whatever else you like. Anyway that doesn't really matter right now (although I might try to write down my thoughts about this some time). The thing is that a few months ago I first had a look at [Haskell](http://haskell.org).
12   -
13   -Haskell is a beauty. If [Java](http://www.oracle.com/technetwork/java/index.html) is a [Volswagen Golf](http://en.wikipedia.org/wiki/Volkswagen_Golf) and [Python](http://python.org/) a [BMW M3](http://en.wikipedia.org/wiki/BMW_M3), then [Haskell](http://haskell.org) is a [Porsche Carrera GT](http://en.wikipedia.org/wiki/Porsche_Carrera_GT), incredible, but hard to drive. The second I finally understood what Haskell was about, I knew that it was going to become my go-to language in the future (once I get it :-). So after dabbling around for a while I thought it was time to have a look at how suited Haskell is for web development and that is where the [Snap Framework](http://snapframework.com/) comes into play. From the site:
14   -
15   -*Snap is a simple web development framework for unix systems, written in the Haskell programming language. Snap has a high level of test coverage and is well-documented.*
16   -
17   -Installation was very easy:
18   -
19   -{% highlight bash %}
20   -cabal install snap
21   -{% endhighlight %}
22   -
23   -So below are a few simple examples that I am playing with to get a hang of the framework before I can build a real project with it (already have an idea for that).
24   -
25   -Getting the request method
26   ---------------------------
27   -
28   -The first thing I tried to figure out was how to get information about the request. Here is a request handler that simply prints out a request's HTTP method. With this as a basis it becomes pretty obvious how to extract other information such as the request URI, headers, etc.
29   -
30   -{% highlight haskell %}
31   -methodHandler = do
32   - methodStr <- (show . rqMethod) <$> getRequest
33   - writeBS $ B.pack (methodStr ++ ['\n'])
34   -{% endhighlight %}
35   -<br />
36   -
37   -Using different handlers with the same route (depending on request parameters)
38   -------------------------------------------------------------------------------
39   -
40   -Although you could use the above mentioned method of getting a request's method to handle these differently using cases or ifs/thens, there is an idiom for returning different responses depending on the request headers. It is based on the `<|>` function. Here is an example:
41   -
42   -{% highlight haskell %}
43   -indexHandler = method GET indexGet
44   - <|> method POST indexPost
45   - <|> errorHandler
46   -{% endhighlight %}
47   -
48   -So what is going on here? Well it's actually pretty simple and entirely based on Snap's implementation of the [Alternatives' "associative binary operator" `(<|>)`](http://hackage.haskell.org/packages/archive/base/4.4.1.0/doc/html/Control-Applicative.html#v:-60--124--62-). The `<|>` operator allows you to *try* a certain handler, but specify following ones in case the former fails. This is what we are doing here. We are saying if the method is `GET` use the `indexGet` handler, if it is `POST` use the `indexPost` handler. If it is neither then use the `errorHandler`. How is this done? Well here is the description of the method function:
49   -
50   -{% highlight haskell %}
51   - method :: MonadSnap m => Method -> m a -> m aSource
52   - -- Runs a Snap monad action only if the request's HTTP
53   - -- method matches the given method.
54   -{% endhighlight %}
55   -
56   -So you give the method function a [`Method`](http://hackage.haskell.org/packages/archive/snap-core/0.6.0.1/doc/html/Snap-Core.html#t:Method) and a handler, then the handler action will be completed if and only if the request's method is the same as the given one. If the methods do not match the method function will call [pass](http://hackage.haskell.org/packages/archive/snap-core/0.6.0.1/doc/html/Snap-Core.html#v:pass) and the handler will fail, resulting in the next handler being tried (`method POST indexPost`). If you want to see how exactly this happens have a look the [method function source](http://hackage.haskell.org/packages/archive/snap-core/0.6.0.1/doc/html/src/Snap-Internal-Types.html#method):
57   -
58   -{% highlight haskell %}
59   -------------------------------------------------------------------------------
60   --- | Runs a 'Snap' monad action only if the request's HTTP method matches
61   --- the given method.
62   -method :: MonadSnap m => Method -> m a -> m a
63   -method m action = do
64   - req <- getRequest
65   - unless (rqMethod req == m) pass
66   - action
67   -{% endhighlight %}
68   -
69   -Note that you can chain these *checks* to create more advanced request handlers. See this extended example:
70   -
71   -{% highlight haskell %}
72   -indexHandler = ifTop (method GET indexGet)
73   - <|> ifTop (method POST indexPost)
74   - <|> errorHandler
75   -{% endhighlight %}
76   -
77   -
78   -Here we are not only checking the request method but also whether or not the request URI is *top* (yes, I agree that this function name is not ideal). Here is the [`ifTop`](http://hackage.haskell.org/packages/archive/snap-core/0.6.0.1/doc/html/Snap-Core.html#v:ifTop) method description and type:
79   -
80   -{% highlight haskell %}
81   -ifTop :: MonadSnap m => m a -> m aSource
82   --- Runs a Snap monad action only when rqPathInfo is empty.
83   -{% endhighlight %}
84   -
85   -What does this mean? Well [`rqPathInfo`](http://hackage.haskell.org/packages/archive/snap-core/0.1.2/doc/html/Snap-Types.html#v:rqPathInfo) return the request's URI's path part that is not covered by the route declaration. If your route is `/posts/2011/` a request for `/posts/2011/11/17/` may still be routed to the specified request handler. The difference will be that in the former case [`rqPathInfo`](http://hackage.haskell.org/packages/archive/snap-core/0.1.2/doc/html/Snap-Types.html#v:rqPathInfo) will return an empty string and in the latter case it will return `11/17/`. So using [`ifTop`](http://hackage.haskell.org/packages/archive/snap-core/0.6.0.1/doc/html/Snap-Core.html#v:ifTop) allows you to say *the request URI may not be longer than the one specified in the routing scheme*.
86   -
87   -But to get back to the point of how to handle different request headers: what this is meant to show is that you can chain different types of request checks to route a request to the correct handler.
88   -
89   -Complete routing example
90   -------------------------
91   -
92   -Here is a complete routing and handling example for an application that I am currently developing:
93   -
94   -{% highlight haskell %}
95   -indexHandler = ifTop ( method GET indexHandler'
96   - <|> genericError 405 "Method Not Allowed"
97   - )
98   - <|> error404 -- will catch any routing error (even for other request
99   - -- URIs as this is the fallback route "/")
100   -
101   -generateHandler = ifTop ( method GET generateHandler'
102   - <|> error405
103   - )
104   -
105   -registeredHandler = ifTop ( method GET registeredHandler'
106   - <|> error405
107   - )
108   -
109   -indexHandler' = do
110   - -- application logic
111   - writeBS $ B.pack "index page"
112   -
113   -generateHandler' = do
114   - expr <- fromMaybe "" <$> getParam "expr"\
115   - -- application logic
116   - writeBS $ append (B.pack "API.generate: ") expr
117   -
118   -registeredHandler' = do
119   - domain <- fromMaybe "" <$> getParam "domain"
120   - -- application logic
121   - writeBS $ append (B.pack "API.registered: ") domain
122   -
123   -error404 = genericError 404 "Not Found"
124   -error405 = genericError 405 "Method Not Allowed"
125   -
126   -genericError c s = do
127   - modifyResponse $ setResponseStatus c $ B.pack s
128   - writeBS $ B.pack ((show c) ++ " - " ++ s)
129   - r <- getResponse
130   - finishWith r
131   -
132   -------------------------------------------------------------------------------
133   --- | The main entry point handler.
134   -site :: Application ()
135   -site = route [ ("/" , indexHandler)
136   - , ("/api/generate/:expr/" , generateHandler)
137   - , ("/api/registered/:domain/" , registeredHandler)
138   - ]
139   - <|> serveDirectory "resources/static"
140   -{% endhighlight %}
141   -
142   -As you can see these handlers combine both `method` and `ifTop` to check whether a request's HTTP method is right and whether or not the request URI contains additional unwanted path segements. Here are a few examples of requests and the server's response:
143   -
144   -{% highlight bash %}
145   -request: GET /
146   -response: HTTP/1.1 200 OK
147   - index page
148   -
149   -request: POST /
150   -response: HTTP/1.1 405 Method Not Allowed
151   - 405 - Method Not Allowed
152   -
153   -request: GET /api/
154   -response: HTTP/1.1 404 Not Found
155   - 404 - Not Found
156   -
157   -request: POST /api/
158   -response: HTTP/1.1 404 Not Found
159   - 404 - Not Found
160   -
161   -request: GET /api/generate/abc
162   -response: HTTP/1.1 200 OK
163   - API.generate: abc
164   -
165   -request: PUT /api/registered/google.com
166   -response: HTTP/1.1 405 Method Not Allowed
167   - 405 - Method Not Allowed
168   -{% endhighlight %}
169   -
170   -Although the above method works as intended it is not as [DRY](http://en.wikipedia.org/wiki/Don't_repeat_yourself) as possible. Because the route function takes a handler as an argument we can actually do the `ifTop` and `method` checks in the route definition (and declare a `methodOrError405` helper function):
171   -
172   -{% highlight haskell %}
173   -methodOrError405 :: Method -> Application () -> Application ()
174   -methodOrError405 m a = method m a
175   - <|> error405
176   -
177   -site :: Application ()
178   -site = route [ ( "/"
179   - , ifTop indexHandler)
180   - , ( "/api/generate/:expr/"
181   - , ifTop (methodOrError405 GET generateHandler'))
182   - , ( "/api/registered/:domain/"
183   - , ifTop (methodOrError405 GET registeredHandler'))
184   - ]
185   - <|> serveDirectory "resources/static"
186   -{% endhighlight %}
187   -
188   -This produces the exact same results as above. *Note that we no longer define the handler as `fooBar`, but rather as `fooBar'` directly (without the checks).*
38 _vim/backup/2011-11-29-solarized-with-putty-and-vim.md~
... ... @@ -1,38 +0,0 @@
1   ----
2   -layout: post
3   -title: Using the Solarized color palette with PuTTY and Vim
4   ----
5   -
6   -{{ page.title }}
7   -================
8   -
9   -[Solarized](http://ethanschoonover.com/solarized/) is a beautiful color palette by Ethan Schoonover. Here is a screenshot of the dark theme:
10   -
11   -<img src="http://ethanschoonover.com/solarized/img/screen-haskell-dark.png" width=585>
12   -
13   -Step 1: Setting up Solarized for PuTTY Tray
14   -===========================================
15   -
16   -[PuTTY Tray](http://haanstra.eu/putty/) is an extension of the default [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/) that adds an invaluable feature which is the ability to load sessions settings from file (the default PuTTY only saves session data in the registry). We will be making use of that feature to set this up here. Here are the steps:
17   -
18   -1. Open PuTTY
19   -2. Click `Change Settings...` (in the PuTTY menu reached by right-clicking the top bar)
20   -3. Select `Default Settings`, click `sessions from file` just below and then click `Save`
21   -4. Open the directory where the `putty.exe` executable is saved
22   -5. Open the `sessions` folder that should now have been created
23   -6. Duplicate the newly created `Default%20Settings` file and rename
24   -7. Load one of these themes in your browser:
25   - - [dark](https://raw.github.com/brantb/solarized/master/putty-colors-solarized/solarized_dark_puttytray.txt)
26   - - [light](https://raw.github.com/brantb/solarized/master/putty-colors-solarized/solarized_light_puttytray.txt)
27   -8. Replace the lines starting with `Color` in the new session file
28   -9. Open PuTTY using this command:
29   -{% highlight bat %}
30   -C:\Putty\putty.exe 10.1.2.20 -l <uname> -pw <pword> -file <session-file>
31   -{% endhighlight %}
32   -
33   -Now you should hopefully have a PuTTY session with the Solarized color scheme!
34   -
35   -Step 2: Setting up Solarized for Vim
36   -====================================
37   -
38   -
109 _vim/backup/2011-12-05-unix-and-log-file-metrics.md~
... ... @@ -1,109 +0,0 @@
1   ----
2   -layout: post
3   -title: Analysing logs with simple UNIX commands
4   ----
5   -
6   -{{ page.title }}
7   -================
8   -
9   -*Note: I am a by no means a UNIX expert. I use these kind of command combinations rarely, so I am sure that there are a hundred and one better ways of doing this.*
10   -
11   -For my bachelor thesis I developed a [MATLAB](http://www.mathworks.com/) program that takes a [Simulink](http://www.mathworks.com/products/simulink/index.html) model and extracts a [POMDP](http://en.wikipedia.org/wiki/Partially_observable_Markov_decision_process) from it. The program does this by simulating the model tens of thousands of times and looking at the model output to build a [state-space](http://en.wikipedia.org/wiki/State_space_(controls%29), an observation-space, a [transition probability matrix](http://en.wikipedia.org/wiki/Stochastic_matrix), an observation probability matrix and a [reward model](http://en.wikipedia.org/wiki/Mathematical_optimization).
12   -
13   -I won't go into the details here, but one of the challenges of this is that neither the state-space nor the observation-space are known before hand. The model runs [initial discovery](http://en.wikipedia.org/wiki/Artificial_intelligence#Learning) simulations and then uses those intitial states to run the actual simulations. While it does this it constantly finds new states and observations that are then also used as a starting point for further simulations. That's all I am going to say for now (I will write a more detailed post about the whole project later, but I first have to see how much I can even say about it because some [industrial partners](http://www.abb.ch/) are involed).
14   -
15   -In any case the important thing here is that because the extraction takes [multiple days](http://en.wikipedia.org/wiki/Combinatorial_explosion) and the end time is not defined (the model keeps growing) it is hard to keep track of what is going on. So today I thought I would see how much I can extract from the log file that the program continuously writes to. Let's get into it.
16   -
17   -I don't think MATLAB offers an internal logging interface, so I wrote my own (bare-bones). It produces output like this:
18   -
19   -<pre>
20   -DEBUG [2011-12-05 19:49:22.639]: TP(326,395,74)=1.000000
21   -DEBUG [2011-12-05 19:49:22.640]: R(326,395,74)=160.066821
22   -DEBUG [2011-12-05 19:49:28.669]: TP(326,396,75)=1.000000
23   -DEBUG [2011-12-05 19:49:28.670]: R(326,396,75)=167.133028
24   -DEBUG [2011-12-05 19:49:28.673]: TP(326,1,76)=1.000000
25   -DEBUG [2011-12-05 19:49:28.673]: R(326,1,76)=-Inf
26   -DEBUG [2011-12-05 19:49:28.675]: TP(326,1,77)=1.000000
27   -DEBUG [2011-12-05 19:49:28.676]: R(326,1,77)=-Inf
28   -</pre>
29   -
30   -The only lines that we will look at here are the ones that show an update of the transition probability matrix and the reward matrix. The format is `TP(source-state,sink-state,action)=value` and `R(source-state,sink-state,action)=value`. Here is a quick example of a transition probability matrix update:
31   -
32   -<pre>
33   -DEBUG [2011-12-05 19:49:22.639]: TP(326,395,74)=1.000000
34   -</pre>
35   -
36   -The above line means that the transition probability of going to state 395 given that we are now in state 326 and we take action 74 is 1. *You may be suprised by that fact that all transition probabilities here are 1, as this means that a certain action from a given state will always lead to the same sink state. This is because the model I am currently extracting from is completely deterministic.*
37   -
38   -So here a few things that I wanted to know from the log file and I how I extracted that information:
39   -
40   -First: **How many states has the extractor discovered?**
41   -
42   -{% highlight bash %}
43   -cut -d " " -f 4- $1 | grep TP | cut -d "," -f 2 | sort -n | uniq | tail -n 1
44   -{% endhighlight %}
45   -
46   -What we do here is cut the lines (getting only the stuff we are interested in), then grepping for lines containing the term 'TP', sorting the lines in ascending order, skipping duplicate lines (not really necessary) and finally taking the last line. *The double `cut` is redundant so I should really fix that, but I can't be bothered.*
47   -
48   -Second: **How many simulations have run?**
49   -
50   -{% highlight bash %}
51   -cat $1 | grep "TP(.*,.*,.*)" | wc -l
52   -{% endhighlight %}
53   -
54   -This command is even simpler, it merely counts the number of line that contain the string 'TP'. Every simulation sets a single transition probability value, so this is an accurate way of getting the total number of simulations.
55   -
56   -Third: **How many errors have occured?**
57   -
58   -{% highlight bash %}
59   -cat $1 | grep "TP(.*,1,.*)" | wc -l
60   -{% endhighlight %}
61   -
62   -This line might no make sense immediately, but it's pretty simple. We are grepping for any tranition probability update that sets a probability value for some state and some action going to sink state 1. We can do this because state 1 is the error state. If the simulation crashes (invalid input, boundary errors, etc) I say taking that action from that source state leads to the error state. So by counting the updates of probabilities reaching the error state we know the number of simulation errors that occurred.
63   -
64   -Fourth: **What's the average reward?**
65   -
66   -Every transition probability is associated with a reward. This reward is the average of all rewards that we got for the given source state, action and sink state. We can see the reward value being set like this `R(source-state,action,sink-state)=reward`.
67   -
68   -{% highlight bash %}
69   - cat $1 | grep "R(" | cut -d "=" -f 2 | grep -v "Inf" | awk \
70   - '{ sum+= $1 ; rowcnt++} END {printf("%.2f\n",sum/rowcnt) }' -
71   -{% endhighlight %}
72   -
73   -This line is the most complicated as it uses an inverse grep and awk. In some cases the reward is set to negative Infinity: `-Inf`. This is not really a useful value and it serves mainly as a placeholder. We certainly can't use it when computing our average reward. So we remove lines containing 'Inf'. Then we sum all the values and finally divide the sum by the number of rows (which awk also keeps track of here).
74   -
75   -Finally: **putting it all together!**
76   -
77   -{% highlight bash %}
78   -
79   -NUM_STATES=$(util/num_states.sh $1)
80   -NUM_SIMS=$(util/num_sims.sh $1)
81   -NUM_ERRS=$(util/num_errors.sh $1)
82   -
83   -PERC_ERRS=$((100*NUM_ERRS/NUM_SIMS))
84   -
85   -AVG_REWARD=$(util/avg_reward.sh $1)
86   -
87   -echo "Extraction statistics:"
88   -echo ""
89   -echo " - number of states: $NUM_STATES"
90   -echo ""
91   -echo " - number of simulations: $NUM_SIMS"
92   -echo " - number of errors: $NUM_ERRS"
93   -echo " - percentage errors: $PERC_ERRS%"
94   -echo ""
95   -echo " - average reward: $AVG_REWARD"
96   -{% endhighlight %}
97   -
98   -
99   -As you can see above all these command are in simple files which I then call in this script. You can run this script manually, but what I do is I run it every two seconds in a small [tmux](http://tmux.sourceforge.net/) pane next to the simulation log output using the very very useful `watch` command:
100   -
101   -{% highlight bash %}
102   -watch simdp/util/show_stats.sh hd_run.log
103   -{% endhighlight %}
104   -
105   -The combination of these script now allow me to easily keep a **clear overview of** what **the simulation** is doing **just by looking at the log file**!
106   -
107   -FYI: here is an [actual log file](http://o1iver.net/media/hd_run.log) (34 MB)
108   -
109   -
40 _vim/backup/2011-12-06-python-discrete-fourier-transformation.md~
... ... @@ -1,40 +0,0 @@
1   ----
2   -layout: post
3   -title: Python implementation of the Discrete Fourier Transform and its Inverse
4   ----
5   -
6   -{{ page.title }}
7   -================
8   -
9   -[Fourier transformations](http://en.wikipedia.org/wiki/Discrete_Fourier_transform) are exceptionally useful for [signal analysis](http://en.wikipedia.org/wiki/Signal_processing). Here is a python implementation of the discrete fourier transform and it's inverse.
10   -
11   -*Note: computing fourier transforms like this is not efficient. If you actually need to compute fourier tranforms consider using [fast fourier transforms](http://en.wikipedia.org/wiki/Fast_Fourier_transform).*
12   -
13   -{% highlight python %}
14   -import cmath
15   -# Discrete fourier transform
16   -def dft(x):
17   - t = []
18   - N = len(x)
19   - for k in range(N):
20   - print('k=%s', k)
21   - a = 0
22   - for n in range(N):
23   - print('n=%s', n)
24   - a += x[n]*cmath.exp(-2j*cmath.pi*k*n*(1/N))
25   - t.append(a)
26   - return t
27   -# Inverse discrete fourier transform
28   -def idft(t):
29   - x = []
30   - N = len(t)
31   - for n in range(N):
32   - a = 0
33   - for k in range(N):
34   - a += t[k]*cmath.exp(2j*cmath.pi*k*n*(1/N))
35   - a /= N
36   - x.append(a)
37   - return x
38   -{% endhighlight %}
39   -
40   -*Note: I have only tested this in python 3.*
55 _vim/backup/404.html~
... ... @@ -1,55 +0,0 @@
1   -<!DOCTYPE html>
2   -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
3   -<head>
4   - <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5   - <title>404 - Page Not Found</title>
6   - <meta name="author" content="Oliver Stollmann" />
7   -
8   - <!-- syntax highlighting CSS -->
9   - <link rel="stylesheet" href="/css/syntax.css" type="text/css" />
10   -
11   - <!-- Homepage CSS -->
12   - <link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen, projection" />
13   - <script type="text/javascript">
14   -
15   - var _gaq = _gaq || [];
16   - _gaq.push(['_setAccount', 'UA-21336041-1']);
17   - _gaq.push(['_trackPageview']);
18   -
19   - (function() {
20   - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
21   - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
22   - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
23   - })();
24   -
25   - </script>
26   -</head>
27   -<body>
28   -
29   -<div class="site">
30   - <div align="center"><img src="http://o1iver.net/media/404.jpg" alt="404"></div>
31   - <div class="footer">
32   - <div class="contact">
33   - <p>
34   - Backward Induction<br />
35   - A blog by <a href="http://o1iver.net/">Oliver Stollmann</a><br />
36   - oliver@stollmann.net
37   - </p>
38   - </div>
39   - <div class="contact">
40   - <p>
41   - <a href="http://github.com/o1iver/">github.com/o1iver</a><br />
42   - <a href="http://bitbucket.org/o1iver/">bitbucket.org/o1iver</a><br />
43   - <a href="http://facebook.com/stollmann/">facebook.com/stollmann</a><br />
44   - </p>
45   - </div>
46   - <div class="rss">
47   - <a href="http://feeds.feedburner.com/o1iver">
48   - <img src="/images/rss.png" alt="Subscribe to RSS Feed" />
49   - </a>
50   - </div>
51   - </div>
52   -</div>
53   -
54   -</body>
55   -</html>
61 _vim/backup/default.html~
... ... @@ -1,61 +0,0 @@
1   -<!DOCTYPE html>
2   -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
3   -<head>
4   - <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5   - <title>{{ page.title }}</title>
6   - <meta name="author" content="Oliver Stollmann" />
7   -
8   - <!-- syntax highlighting CSS -->
9   - <link rel="stylesheet" href="/css/syntax.css" type="text/css" />
10   -
11   - <!-- Homepage CSS -->
12   - <link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen, projection" />
13   - <script type="text/javascript">
14   -
15   - var _gaq = _gaq || [];
16   - _gaq.push(['_setAccount', 'UA-21336041-1']);
17   - _gaq.push(['_trackPageview']);
18   -
19   - (function() {
20   - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
21   - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
22   - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
23   - })();
24   -
25   - </script>
26   -</head>
27   -<body>
28   -
29   -<div class="site">
30   - <div class="title">
31   - <a href="/">Backward Induction - A blog by Oliver Stollmann</a>
32   -
33   - </div>
34   -
35   - {{ content }}
36   -
37   - <div class="footer">
38   - <div class="contact">
39   - <p>
40   - Backward Induction<br />
41   - A blog by <a href="http://o1iver.net/">Oliver Stollmann</a><br />
42   - oliver@stollmann.net
43   - </p>
44   - </div>
45   - <div class="contact">
46   - <p>
47   - <a href="http://github.com/o1iver/">github.com/o1iver</a><br />
48   - <a href="http://bitbucket.org/o1iver/">bitbucket.org/o1iver</a><br />
49   - <a href="http://facebook.com/stollmann/">facebook.com/stollmann</a><br />
50   - </p>
51   - </div>
52   - <div class="rss">
53   - <a href="http://feeds.feedburner.com/o1iver">
54   - <img src="/images/rss.png" alt="Subscribe to RSS Feed" />
55   - </a>
56   - </div>
57   - </div>
58   -</div>
59   -
60   -</body>
61   -</html>
29 _vim/backup/dft.py~
... ... @@ -1,29 +0,0 @@
1   -import cmath
2   -
3   -# Discrete fourier transform
4   -def dft(x):
5   - t = []
6   - N = len(x)
7   - for k in range(N):
8   - print('k=%s', k)
9   - a = 0
10   - for n in range(N):
11   - print('n=%s', n)
12   - #a += x[n]*cmath.exp(-1*2j*cmath.pi*k*n*(1/(N+1)))
13   - a += x[n]*cmath.exp(-2j*cmath.pi*k*n*(1/N))
14   - t.append(a)
15   - return t
16   -
17   -# Inverse discrete fourier transform
18   -def idft(t):
19   - x = []
20   - N = len(t)
21   - for n in range(N):
22   - a = 0
23   - for k in range(N):
24   - a += t[k]*cmath.exp(2j*cmath.pi*k*n*(1/N))
25   - a /= N
26   - x.append(a)
27   - return x
28   -
29   -
18 _vim/backup/show_stats.sh~
... ... @@ -1,18 +0,0 @@
1   -NUM_STATES=$(simdp/util/num_states.sh $1)
2   -NUM_SIMS=$(simdp/util/num_sims.sh $1)
3   -NUM_ERRS=$(simdp/util/num_errors.sh $1)
4   -
5   -PERC_ERRS=$((100*NUM_ERRS/NUM_SIMS))
6   -
7   -AVG_REWARD=$(simdp/util/avg_reward.sh $1)
8   -
9   -echo "Extraction statistics:"
10   -echo ""
11   -echo " - number of states: $NUM_STATES"
12   -echo ""
13   -echo " - number of simulations: $NUM_SIMS"
14   -echo " - number of errors: $NUM_ERRS"
15   -echo " - percentage errors: $PERC_ERRS%"
16   -echo ""
17   -echo " - average reward: $AVG_REWARD"
18   -
BIN  _xmonad/xmonad-x86_64-linux
Binary file not shown
BIN  _xmonad/xmonad.o
Binary file not shown

No commit comments for this range

Something went wrong with that request. Please try again.