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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func size(depth int, alpha *[]string) int { | |
return int(math.Pow(float64(len(*alpha)), float64(depth))) | |
} |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"strings" | |
) | |
type State struct { | |
name string |
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
import Data.List | |
import Data.List.Split | |
import Data.Ord | |
import System.Environment | |
theta :: (Num a, Eq a, Ord a, Fractional a) => (a,a) -> (a,a) -> a | |
theta (x1,y1) (x2,y2) | |
| dx == 0 && dy == 0 = 0 | |
| dx < 0 = 2 - t | |
| dy < 0 = 4 + t |
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
def self.pretty_json(o, l=0) | |
o.class == Hash ? "{\n" + o.keys.map { |k| (" " * (l + 1) * INDENT) + "\"#{k.to_s}\": " + pretty_json(o[k], l + 1) }.join(",\n") + "\n" + (" " * l * INDENT) + "}" : o.class == Array ? "[\n" + o.map { |k| (" " * (l + 1) * INDENT) + pretty_json(k, l + 1) }.join(",\n") + "\n" + (" " * l * INDENT) + "]" : o.inspect | |
end |
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
def calculate(mat, mul=1): | |
return (mul * mat[0][0] if len(mat) == 1 else sum((mul * calculate(list(map(lambda j: list(filter(lambda el: el != None, (mat[j][k] if k != i else None for k in range(len(mat))))), range(1, len(mat)))), (-1 if i % 2 == 0 else 1) * mat[0][i])) for i in range(len(mat)))) | |
matrix = [ | |
[1, -2, 3], | |
[0, -3, -4], | |
[0, 0, -3] | |
] | |
print(calculate(matrix)) |
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
/// Please don't do this | |
func iff(condition: Bool, block: () -> ()) -> Bool { | |
if(condition) { | |
block() | |
} | |
return condition | |
} | |
func iff<T>(optional: Optional<T>, block: (val: T) -> ()) -> Bool { |
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
read("", :program, { | |
def(:program_length, send(program, :length)) | |
def(:program_location, 0) | |
def(:input, (1, 2, 3, 4)) | |
def(:input_location, 0) | |
def(:program_char, { | |
send(program, :substring, program_location, +(program_location, 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
defmodule RegexCond do | |
defmacro match(matchable, do: matches) do | |
IO.inspect matches | |
de_sigged = matches |> Enum.map(fn | |
{:"->", context, [[lhs], code]} -> | |
lhs = de_sig matchable, lhs | |
{:"->", context, [[lhs], code]} | |
end) | |
quote do |
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
#!/usr/bin/env ruby | |
DETAILED_MODE = !ARGV[2].nil? | |
begin | |
require 'yomu' | |
rescue LoadError | |
msg = '(Looks like this is you)' | |
lab = `hostname`.strip.start_with? 'cs' | |
puts <<-EOF | |
You need the 'yomu' gem to use this script. |
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
### Keybase proof | |
I hereby claim: | |
* I am willhbr on github. | |
* I am willhbr (https://keybase.io/willhbr) on keybase. | |
* I have a public key ASBPxIfCrNsJrL_PZpocUrsB3CWHeAeWZV7Bm_dHMutf8wo | |
To claim this, I am signing this object: |
OlderNewer