Energy | Time | Mb | |||
---|---|---|---|---|---|
(c) C | 1.00 | (c) C | 1.00 | (c) Pascal | 1.00 |
(c) Rust | 1.03 | (c) Rust | 1.04 | (c) Go | 1.05 |
(c) C++ | 1.34 | (c) C++ | 1.56 | (c) C | 1.17 |
(c) Ada | 1.70 | (v) Ada | 1.85 | (c) Fortran | 1.24 |
(v) Java | 1.98 | (v) Java | 1.89 | (c) C++ | 1.34 |
(c) Pascal | 2.14 | (c) Chapel | 2.14 | (c) Ada | 1.47 |
(c) Chapel | 2.18 | (c) Go | 2.83 | (c) Rust | 1.54 |
(v) Lisp | 2.27 | (c) Pascal | 3.02 | (v) Lisp | 1.92 |
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 Optional | |
from boto3 import Session | |
from botocore import UNSIGNED | |
from botocore.config import Config | |
from mypy_boto3_servicecatalog.literals import ServiceName | |
def build_service_exceptions( | |
service_name: ServiceName, *, session: Optional[Session] = 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
#!/bin/bash | |
# this script requires curl, jq, and npm to be available in the PATH | |
# it also requires a github access token (with org read access) to be in ~/.dependabotrc.json in | |
# this form: | |
# {"github_token":"<token>"} | |
if [[ "$#" -lt 1 ]]; then | |
echo "usage: $0 <package_name>" >&2 | |
exit 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
import tensorflow as tf | |
dataset = tf.data.Dataset.from_generator(lambda: None, tf.float32) | |
# raises no errors | |
dataset.map(lambda i: (i, tf.zeros(tf.float32))) | |
zeros = tf.zeros(tf.float32) | |
# raises KeyError: 'zeros:0' | |
dataset.map(lambda i: (i, zeros)) |
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
#!/bin/bash | |
INTERVAL=1 | |
afile="$(mktemp)" | |
bfile="$(mktemp)" | |
function show_diff() { | |
a="$1" | |
b="$2" |
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 scipy.optimize | |
# let check_grad work for x0: ndarray, like the documentation says it should | |
# see also: http://stackoverflow.com/q/15040263 | |
def check_grad(func, grad, x0, *args, **kwargs): | |
return scipy.optimize.check_grad(lambda xh: func(xh.reshape(x0.shape), *args), | |
lambda xh: grad(xh.reshape(x0.shape), *args).flatten(), | |
x0.flatten(), **kwargs) |
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
var hasOwn = Object.prototype.hasOwnProperty; | |
var indexOf = Array.prototype.indexOf; | |
function isObjectEmpty(obj) { | |
for (var key in obj) { | |
return false; | |
} | |
return true; | |
} |
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
var crypto = require('crypto'); | |
// larger numbers mean better security, less | |
var config = { | |
// size of the generated hash | |
hashBytes: 32, | |
// larger salt means hashed passwords are more resistant to rainbow table, but | |
// you get diminishing returns pretty fast | |
saltBytes: 16, | |
// more iterations means an attacker has to take longer to brute force an |
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
#!/bin/bash | |
# arrange outputs in order of name | |
params=() | |
prev='' | |
verbose=0 | |
if [ "$1" == '-v' ] || [ "$1" == '--verbose' ]; then | |
verbose=1 | |
shift | |
fi |
NewerOlder