Skip to content

Instantly share code, notes, and snippets.

View wotori's full-sized avatar
🦀
Fighting with the borrow checker

Wotori Movako wotori

🦀
Fighting with the borrow checker
View GitHub Profile
@wotori
wotori / seqToList.py
Created November 14, 2018 21:05
'.jpg' or '.png' sequence to a list
def seqToArray(path):
data = []
for i in range(1491):
if os.listdir(path)[0][-3:] == 'jpg':
data.append(array(Image.open(path + '{}'.format(i+1) + '.jpg')))
elif os.listdir(path)[0][-3:] == 'png':
data.append(array(Image.open(path + '{}'.format(i+1) + '.png')))
else :
print('there is no "jpg" jr "png" inside')
return data
@wotori
wotori / Keras_training_test.py
Last active November 16, 2018 16:52
Working Keras with random generated data
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.optimizers import SGD
# Generate dummy data
x_train = np.random.random((100, 100, 100, 3))
y_train = keras.utils.to_categorical(np.random.randint(10, size=(100, 1)), num_classes=10)
@wotori
wotori / Dijkstra.py
Created November 21, 2018 16:14
Dijkstra
def Dijkstra(N, S, matrix):
valid = [True] * N
weight = [1000000] * N
weight[S] = 0
for i in range(N):
min_weight = 1000001
ID_min_weight = -1
for i in range(len(weight)):
if valid[i] and weight[i] < min_weight:
min_weight = weight[i]
@wotori
wotori / links_and_materials
Last active April 17, 2020 18:15
«Симбиоз дизайна и технологий» / используемы материалы и ссылки
open current directory
explorer.exe `wslpath -w "$PWD"`
@wotori
wotori / FSM.md
Last active May 20, 2021 16:03
FSM

Finite State Machine based on youtube video
The same solution splited to modules is here

from random import randint
from time import sleep

# _____________________________________________________
State = type("State", (object,), {})

@wotori
wotori / docker_without_sudo.txt
Last active February 17, 2022 18:47
docker without sudo
#1 - should be enough
sudo setfacl -m user:$USER:rw /var/run/docker.sock
#2
sudo usermod -aG docker $USER
#3
sudo groupadd docker
sudo gpasswd -a $USER docker
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch path_to_file' HEAD
@wotori
wotori / ffmpeg
Last active April 22, 2022 08:08
video to gif
```
ffmpeg -ss 0 -t 10 -i enter.mp4 -vf "fps=10,scale=500:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 enter.gif
```
# reduce animation
dconf write /org/gnome/desktop/interface/enable-animations false