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 main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"os" | |
) | |
func main() { |
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
WS: /[ \t\f\r\n]/+ | |
DIGIT: "0".."9" | |
INT: DIGIT+ | |
FLOAT: DIGIT? "." DIGIT+ | |
| DIGIT+ "." | |
int: INT | |
float: FLOAT | |
// simple types |
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 pathlib import Path | |
from urllib.parse import quote | |
index = [] | |
for i in sorted(Path('.').iterdir()): | |
index.append(i) | |
with open('index.html', 'w') as f: | |
f.write('<html><body><center>') |
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 tensorflow.keras import backend as K | |
from tensorflow.keras.layers import Layer | |
class CoordinateChannel2D(Layer): | |
def call(self, inputs): | |
x = K.cast(K.arange(0, K.shape(inputs)[1]), K.floatx()) | |
x /= K.cast(K.shape(inputs)[1], K.floatx()) |
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 [ -z "$YC_API_KEY" ]; then | |
cat << EOF | |
Yandex Cloud API Key is needed: | |
https://cloud.yandex.ru/docs/iam/concepts/authorization/api-key | |
it would require some hustle with service account and roles: | |
https://cloud.yandex.ru/docs/speechkit/security/ |
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 perl | |
use open qw(:std :utf8); | |
use Encode qw(decode); | |
while (my $line = <STDIN>) { | |
print decode("MIME-Header", $line); | |
} |
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/sh | |
find -name .git -a -type d -prune -o -type f -print0 | du --bytes -h --files0-from=- | sort -rh |
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
for i in *; do | |
echo "Converting $i..." | |
ffmpeg -nostdin -i $i -c:v h264_nvenc -preset slow -cq 10 -bf 2 -g 150 ${i%.*}.mp4.tmp && \ | |
rm $i && \ | |
mv ${i%.*}.mp4.tmp ${i%.*}.mp4 | |
echo | |
done |
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 keras import backend as K | |
import keras | |
def reset_weights(model): | |
session = K.get_session() | |
for layer in model.layers: | |
if isinstance(layer, keras.engine.network.Network): | |
reset_weights(layer) | |
continue | |
for v in layer.__dict__.values(): |
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
class DFS(dict): | |
def __getattr__(self, key): | |
return self[key] | |
def __setattr__(self, key, value): | |
self[key] = value | |
def __dir__(self): | |
return list(self) |