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 os | |
import sys | |
import json | |
import whisper | |
from time import perf_counter, ctime | |
# dependency: https://github.com/openai/whisper#setup | |
def log(s) -> None: |
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
from typing import List, Optional | |
def get_array_from_dict(d: dict, key: str, default: List[object] = list()) -> List[object]: | |
"""Gets an array from a dict. Casts the type to List. Allows defaults to be set - no errors thrown.""" | |
return d.get(key, default) | |
foo = get_array_from_dict({}, "foo") | |
bar = get_array_from_dict({}, "bar") | |
foo.append(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
#!/usr/bin/env python3 | |
import sys | |
from urllib.request import urlopen | |
# python3 -m pip install --user textblob | |
# python3 -m textblob.download_corpora | |
from textblob import TextBlob | |
def relevant_words(): |
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
trait A { | |
val foo: Int = { | |
println("A.foo") | |
1 | |
} | |
println(s"foo on construction: $foo") | |
} | |
class B extends A { |
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 scala.collection.mutable | |
object Example { | |
case class Parent(private val childLocator: ChildLocator) { | |
lazy val child = childLocator.locate(from = this) | |
} | |
case class Child(parent: Parent) | |
class ChildLocator { // mutable |
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
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
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
MONTHLY_INVESTMENT = 188.0 | |
MONTHS_TO_INVEST = 120 | |
YEARLY_INTEREST = 0.04 | |
MONTHLY_INTEREST = (1 + YEARLY_INTEREST)**(1.0/12) - 1 | |
def main(): | |
balance = 0 | |
for month in xrange(MONTHS_TO_INVEST): |
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
window_set_window_handlers(s_main_window, (WindowHandlers) { | |
.load = main_window_load, | |
.unload = main_window_unload | |
}); |