I hereby claim:
- I am kasimte on github.
- I am kasim (https://keybase.io/kasim) on keybase.
- I have a public key ASAKS4iJvRsfmLAjWOebG4mjHFY3XQTMe86umzEfb7niJQo
To claim this, I am signing this object:
# Requirements: | |
# - Python 3 | |
# - gym | |
# | |
# This is a sample script that familiarizes one with OpenAI's gym | |
# environment. | |
# | |
# It is modified from: | |
# | |
# https://github.com/vmayoral/basic_reinforcement_learning/tree/master/tutorial3 |
# Neural Network config | |
CONV_FILTERS = [32, 48] | |
CONV_KERNEL_SIZES = [6, 5] | |
CONV_STRIDES = [2, 2] | |
for c, (filters, kernel_size, strides) in enumerate(zip(CONV_FILTERS, CONV_KERNEL_SIZES, CONV_STRIDES)): | |
print("index") | |
print(c) # this is the index | |
# everything else is just unpacked | |
print(filters) |
import tensorflow as tf | |
a = tf.constant([[0, 1], [2, 0], [0, 3]]) | |
b = tf.reduce_sum(a) | |
c = tf.reduce_sum(a, 0) # reduce by column | |
d = tf.reduce_sum(a, 1) # reduce by row | |
for tensor in [b, c, d]: | |
result = tf.Session().run(tensor) | |
print(result) |
<!-- From https://github.com/fastai/fast_template/blob/6f72d2957a4e302e437f4437dd6a1e5a1f14274a/_includes/head.html --> | |
{% if site.use_mathjax %} | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous"> | |
<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> | |
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script> | |
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script> | |
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
renderMathInElement( document.body |
I hereby claim:
To claim this, I am signing this object:
[diff] | |
tool = diffmerge | |
[difftool "diffmerge"] | |
cmd = diffmerge \"$LOCAL\" \"$REMOTE\" | |
[merge] | |
tool = diffmerge | |
[mergetool "diffmerge"] | |
cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\"" | |
trustExitCode = true |
extension Array where Element: Encodable { | |
/// - Returns: An array having removed any element of the array which is not encodable itself. | |
func filterUncodable() -> [Element] { | |
return self.filter { (el: Element) -> Bool in | |
let encoded = try? JSONEncoder().encode(el) | |
return encoded != nil ? true : false | |
} | |
} | |
} |
import WebKit | |
import RxSwift | |
import RxCocoa | |
public extension Reactive where Base: WKScriptMessageHandler { | |
func didReceiveMessage() -> Observable<(WKUserContentController, WKScriptMessage)> { | |
return self.methodInvoked(#selector(Base.userContentController)) | |
.map { args in | |
guard args.count == 2, | |
let controller = args[0] as? WKUserContentController, |
# output.py (separate file) | |
print(37.234) | |
# capture_output_from_script.py | |
import subprocess | |
# run output.py as subprocess and capture output, format it, convert to float, and print | |
x = float(subprocess.check_output('python output.py', shell=True, text=True).strip()) | |
print(x) |
def latest_match_from(path, match): | |
# read the modification time | |
mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime | |
# read all files from path and sort based on modification time | |
files = list(sorted(os.listdir(path), key=mtime)) | |
# filter based on match | |
matches = [a for a in files if match in a] | |
# return the full path of the most recent match | |
return os.path.join(path, matches[-1]) |