This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) |
This file contains hidden or 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 | |
| set -e | |
| set -x | |
| [ -n "`nmcli c show --active | grep -e Pythonidae -e Kazan_89`" ] || exit 0 | |
| pacman -S --refresh --sysupgrade --downloadonly --noconfirm | |
| pacman -S --clean --noconfirm |
This file contains hidden or 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 sklearn.datasets import make_blobs | |
| import numpy as np | |
| coords, counties = make_blobs(1000, centers=20) | |
| values = np.random.randint(0, 100, [20]) | |
| with open("input.csv", "w") as f: | |
| f.write('Town,X,Y,County,Value\n') | |
| for town, ((lon, lat), county) in enumerate(zip(coords, counties), 1): |