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
words = open("advent5.txt").each_line.map(&:strip) | |
doubles = /([a-z]{2}).*\1/ | |
repeat = /([a-z])[a-z]\1/ | |
nice = words.select { |s| s =~ doubles and s =~ repeat } | |
p nice.size |
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
words = open("advent5.txt").each_line.map(&:strip) | |
vowels = /[aeiou]/ | |
doubles = /([a-z])\1/ | |
bad = /(ab|cd|pq|xy)/ | |
nice = words.select { |s| (s.scan(vowels).size >= 3) and (s =~ doubles) and not (s =~ bad) } | |
p nice.size |
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
def ip_to_int(ip) | |
ip.split(".").map(&:to_i).reverse.each_with_index.map {|n,i| n << (i*8) }.reduce(:+) | |
end | |
def range_to_ip_and_mask(range) | |
ip, width = range.split("/") | |
mask = 0xffffffff >> width.to_i | |
[ip_to_int(ip), mask] | |
end |
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
defmodule C do | |
def map([], _f), do: [] | |
def map([ head | tail ], f), do: [ f.(head) | map(tail, f) ] | |
end | |
# works | |
IO.inspect C.map [1,2,3,4,5], fn x -> x*x end |
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
https://code.google.com/p/mintty/wiki/Keycodes | |
http://rtfm.etla.org/xterm/ctlseq.html | |
http://man7.org/linux/man-pages/man4/console_codes.4.html | |
http://www.termsys.demon.co.uk/vtansi.htm | |
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html | |
CSI = ESC[ | |
K |
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
$ nvcc --gpu-architecture=compute_20 --gpu-code=compute_20 -I/usr/local/cuda/include/ -DGPU --compiler-options "-Wall -Ofast -DGPU" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o | |
/usr/local/cuda/include/cuda_fp16.h:314:83: error: conflicting declaration of C function ‘__half __ldg(const __half*)’ | |
/usr/local/cuda/include/cuda_fp16.h:313:60: note: previous declaration ‘__half2 __ldg(const __half2*)’ | |
/usr/local/cuda/include/cuda_fp16.h: In function ‘__half2 __ldg(const __half2*)’: | |
/usr/local/cuda/include/cuda_fp16.h:1180:84: error: conflicting declaration of C function ‘__half2 __ldg(const __half2*)’ | |
/usr/local/cuda/include/cuda_fp16.h:314:59: note: previous declaration ‘__half __ldg(const __half*)’ | |
Makefile:54: recipe for target 'obj/convolutional_kernels.o' failed | |
make: *** [obj/convolutional_kernels.o] Error 1 |
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
MS4wLjU5|Q2hlYXRlciA6KAoKN4IglgJiBcIG4AYB0AmEAaEALApgQwCcAXAI3yIEkpZFVpdDTyMQBXAOzCKIE8AHHAGcYoMOzhhBYEgBscWPEQDGuAjxggAjCwC2zWAGZUCBAHYArADYEKBAYAsCc45uWUOANSabLGYTh4Gpb2luYI1qb2KAaatgCcRiimpgAcLEoA9pkZ7BoILEQ4BARcGWoaKEgxmimWcVGWKTF1mnHe5p6mBiw47EUA5uqwNXHIduZxKfbTpprBBnGWpiwEQgJKAKJ9BIN5LH0AHqzCsPbpaoJEeDJ7mDqsV/29tyB8q/ePz8Pec/VxziYWHhBEpelIchpvCwAGarHAAJTWOCUFRYEAIORwkKQ9hiBhQuPMpksSwQUxMcXcHlGLAAjqwcF8QJUUKNzJook5IgYUosDPjTJ00pg+pcNKYkJoObMUs44qYUFYUiZzOYUp4lix+qtFEV6YzcsMkAh7BYEhyUqZ6hNiSheZ41SwsGA4FjYCkkP9LcEposEilFSayZ57MLsC6cPqmfYkAHYjZNOzori2irBR5HD0dG8hCcQB65uYUG4DFYkqyQlECZ58Sw3hk+LgiNiFjUHCSUgHZYqulZPMWtRkIBBcxV7HEEo06klLAYTLKSeY63h2ERcBDYPlMHwV2ucDk0Jvl6v1+xukft7vT2cL68r/v2EvbxlXQQdGJqCAtyAX0V3+wIEPL8WF/N8P3PYDMFA/8IBvSCf1fGCn3g6CP0sF5BAAd0IHQZDEfoMKIfCigwvhIBI28dAyQR6VKIJ+WJXllSLNVx3qRxrF8LJjmbWBLCQEkEnqTQHGmDse1Cfs0EwDE8BUDQ4iqXkunlSw5nsRNTDMETNCkrUwF3QQyJHAgNHMSVHBQRMEASfF7GcKyrQMPTMFBVcwAEEcNCMLSLCshBvFNfEwgnKz+20TBsKMl4RzgDJWFWUzb36DIN3gzh+iwUhWAIyiMjXDRam/EhFBeD4r0UFQiiGEB+RcEwGsahqIpAcrV |
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
BASIC_NUMERALS = { | |
1000 => "M", | |
500 => "D", | |
100 => "C", | |
50 => "L", | |
10 => "X", | |
5 => "V", | |
1 => "I", | |
} |
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
while (true) | |
{ | |
localRenderView.b(bool2); | |
f.a(this); | |
return; | |
bool2 = true; | |
} | |
this.rv.a(0); | |
return; | |
this.rv.a(1); |
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
r, w = IO.pipe | |
Process.run("cat", input: r) | |
100.times { w.puts "hello" } | |
w.close |