This file contains 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
<?php | |
function factorial($n) { | |
if (!$n) | |
return 1; | |
return $n * factorial($n-1); | |
} | |
function Y($f) { | |
$g = function ($x) use($f) { |
This file contains 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
// CracklePop | |
// Problem: Write a program that prints out the numbers 1 to 100 (inclusive). | |
// If the number is divisible by 3, print Crackle instead of the number. | |
// If it's divisible by 5, print Pop. | |
// If it's divisible by both 3 and 5, print CracklePop. | |
// Solution: regex is not only perfectly capable of lexing HTML, | |
// it is also perfectly capable of expressing, in a roundabout way, | |
// a finite automaton that verifies divisibility by a given number. |
This file contains 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
template<typename T> | |
struct vector { int length; T* data; }; | |
using vector_int = vector<int>; | |
using vector_float = vector<float>; | |
// F is a function type that takes T and returns R | |
// Map takes a vector<T>, and F and returns vector<R> | |
template<class T, class F> | |
auto Map(vector<T> input, F func){ |
This file contains 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
uniform int n_lin_segments; | |
uniform vec2 lin_segments[256]; | |
uniform int n_quad_segments; | |
uniform vec2 quad_segments[512]; | |
varying vec3 pos; | |
varying vec2 uv; | |
void main() { | |
vec2 point = uv; | |
// point = (point + vec2(0.3, 0)) * 0.1; |
This file contains 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
// An exercise in converting a regex to an NFA to a DFA | |
type RegexNode = | |
| Or of RegexNode list | |
| Seq of RegexNode List | |
| Star of RegexNode | |
| T of string | |
| Eta (* todo: does this value really belong here? *) | |
let regex_pattern = "x(x|y)*|z" |
This file contains 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
0000000000001640 <fib_SpYa5EuiU0areDDc1bSasA(unsigned long long)>: | |
1640: 48 83 ff 01 cmp $0x1,%rdi | |
1644: b8 01 00 00 00 mov $0x1,%eax | |
1649: 77 05 ja 1650 <fib_SpYa5EuiU0areDDc1bSasA(unsigned long long)+0x10> | |
164b: f3 c3 repz retq | |
164d: 0f 1f 00 nopl (%rax) | |
1650: 41 57 push %r15 | |
1652: 41 56 push %r14 | |
1654: 4c 8d 77 fe lea -0x2(%rdi),%r14 | |
1658: 41 55 push %r13 |
This file contains 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
POC of applying some Async primitives to a Poker game for a discussion on async from gamedev.stackexchange.com |
This file contains 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
jimmy@4f9659dd76f5:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.I6Cq8DlByE --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-stable.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
gpg: requesting key D3D831EF from hkp server keyserver.ubuntu.com | |
gpg: /etc/apt//trustd |
This file contains 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
Advent of Code 2017 Solutions |
This file contains 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
#nowarn "9" | |
open System | |
open System.Runtime.InteropServices | |
[<StructLayout(LayoutKind.Sequential)>] | |
type DEVMODEInfo = struct | |
[<MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)>] | |
[<DefaultValue>] val mutable dmDeviceName : string | |
[<DefaultValue>] val mutable dmSpecVersion: int16; | |
[<DefaultValue>] val mutable dmDriverVersion: int16; |
NewerOlder