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
var net = require('net'); | |
var util = require('util'); | |
var Writable = require('stream').Writable; | |
/** | |
* Pretends to consume the data written to it. In reality, it just eats data | |
* really slowly. | |
* | |
* @constructor | |
* @extends Writable |
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
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 | |
if [ "$#" -eq 0 ]; then | |
md5sum "$@" | |
exit 0 | |
fi | |
recursive=0 | |
exclude=0 | |
sum=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
#!/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) |
NewerOlder