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 Script do | |
@moduledoc false | |
use Application | |
alias Alchemy.Client | |
@token "token" | |
defmodule Commands do | |
use Alchemy.Cogs |
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
defmacro thunk(b) do | |
quote do: fn -> unquote(b) end | |
end | |
defmacro a ~> b do | |
quote do | |
unquote(a) = thunk(eval(unquote(b))) | |
end | |
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 getEvents(page): | |
pattern = "%Y-%m-%dT%H:%M:%S%z" | |
start_time = datetime.datetime.utcfromtimestamp(datetime.datetime.strptime(event['start_time'], pattern).timestamp()).replace(tzinfo=pytz.utc) | |
now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc) | |
events = (x for x in userGraph.get(path='{}/events'.format(page['id'], type='page')['data']) | |
if now < start_time | |
and x['id'] not in sent) | |
return [Event(name=event['name'], id=event['id'], start_time=event['start_time']) |
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
data Category = Category { catName :: String | |
, leaderboard :: Url} deriving (Show) | |
instance FromJSON Category where | |
parseJSON (Object o) = Category | |
<$> (o .: "name") | |
<*> (last <$> o .: "links" >>= (.: "uri")) | |
data RunData = RunData { runs :: [Run]} deriving (Show) | |
instance FromJSON RunData where | |
parseJSON (Object o) = RunData |
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 Linear do | |
@moduledoc """ | |
Various useful functions for linear algebra operations | |
""" | |
@doc ~S""" | |
Zips every element in a, with every element in b, applying a function | |
at the same time | |
## Examples |
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 Counter; | |
public class Counter { | |
private int num; | |
public Counter(int num) { | |
this.num = num; | |
} |
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
defp evaluate(message, code) do | |
result = try do | |
{result, _} = Code.eval_string(code, [message: message], __ENV__) | |
result | |
rescue | |
e -> e | |
end | |
end | |
defp eval_embed(input, output) 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
defmodule Bot do | |
@moduledoc false | |
use Application | |
alias Alchemy.Client | |
def start(_, _) do | |
run = Client.start(@local, selfbot: "my_id") | |
use Eval | |
run |
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
type Activator = Double -> Double | |
type Weights = Matrix | |
type Bias = Vector | |
-- A layer can be seen as a big function from Vector -> Vector | |
-- When the `input` is omitted, this becomes a curried function | |
layer :: Weights -> Bias -> Activator -> (Vector -> Vector) | |
layer weights bias activator input = map activator | |
(weights |*| input |+| bias) |
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 Bot do | |
use Application | |
alias Alchemy.client | |
@token "token here" | |
def start(_, _) do | |
run = Client.start(@token) | |
use Commands | |
run |
OlderNewer