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
| int n = this->x.size() + 1; // + 1 is used if the 1x1 box is excluded | |
| int s = this->s.val(); | |
| std::vector<std::vector<char> > buffer(s, std::vector<char>(s, ' ')); | |
| for (int i = 0; i < n - 1; i++) { | |
| int size = this->size(n, i); // Size of box i | |
| int x = this->x[i].val(); | |
| int y = this->y[i].val(); | |
| if (size > 1) { | |
| for (int xl = x; xl < x + size; xl++) { |
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
| $wc = new-object System.Net.WebClient | |
| # Note: Change the extension of the subscription link to csv | |
| $link = "https://se.timeedit.net/web/uu/db1/schema/ri63061Y655010QQ65ZY653909550863X06Y09X6055X57660609Y07Q7ZyQ8.csv" | |
| [System.Text.Encoding]::UTF8.GetString($wc.DownloadData($link)).Split("`n") | ` | |
| select -skip 3 | ConvertFrom-Csv | ` | |
| Sort-Object startdatum,starttid | ` | |
| where {$_.Startdatum -ge [System.DateTime]::Now.ToShortDateString()} | ` | |
| select startdatum,starttid,kurs,moment,lokal,lärare -First 10 | ` | |
| Format-Table -AutoSize |
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
| Function YT-ChanRip($channel) { | |
| $wc = New-Object System.Net.WebClient | |
| for ($index = 1;; $index = $index + 50) { | |
| $url = "http://gdata.youtube.com/feeds/api/users/$channel/uploads?start-index=$index&max-results=50" | |
| $page = $wc.DownloadString($url) | |
| $matches = [System.Text.RegularExpressions.Regex]::Matches($page, "watch\?v=[^ `"`'\\]{11}") | |
| if ($matches.Count -eq 0) { return } | |
| $uniquematches = $matches | Sort-Object | Get-Unique -AsString | |
| foreach ($match in $uniquematches) { | |
| iex "youtube-dl.exe --title --no-overwrites http://youtube.com/$match" |
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
| #!/usr/bin/env python2.7 | |
| from __future__ import print_function | |
| from min_difference import * | |
| from string import ascii_lowercase | |
| import random | |
| def defvalf(a, b): | |
| return 0 if a==b else 1 | |
| def makeR(firstAlpha, secondAlpha, valf=defvalf): |
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
| infix 1 |> !> !?> | |
| fun v |> f = f v | |
| fun NONE !> _ = NONE | |
| | (SOME v) !> f = f v | |
| fun NONE !?> _ = NONE | |
| | (SOME v) !?> f = SOME (f v) | |
| (* Example usage: *) | |
| fun isqrt n = | |
| let val r = n |> real |> Math.sqrt |> round |
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
| datatype ('a, 'b) state = State of ('a -> 'b * 'a) | |
| infix >>= >> | |
| fun runState (State f) s = | |
| f s | |
| fun op>>= (act1, fact2) = | |
| State (fn s => | |
| let | |
| val (iv, is) = runState act1 s | |
| val act2 = fact2 iv | |
| in |
NewerOlder