Skip to content

Instantly share code, notes, and snippets.

View aleksas's full-sized avatar

Aleksas Pielikis aleksas

View GitHub Profile
@aleksas
aleksas / test.sh
Created December 5, 2018 01:01
Try t2t on lt
PROBLEM=encoder_character_stressor
MODEL=transformer_encoder
HPARAMS=transformer_base
DATA_DIR=$HOME/t2t_data
TMP_DIR=/tmp/t2t_datagen
TRAIN_DIR=$HOME/t2t_train/$PROBLEM/$MODEL-$HPARAMS
BATCH_SIZE=2048
WORKER_GPU=2
TRAIN_STEPS=500000
USR_DIR=.
@aleksas
aleksas / all.md
Last active January 20, 2019 20:53
a list of OSM seniūnija objects
@aleksas
aleksas / name_number.py
Last active April 6, 2019 15:58
Number conversion to textual representation
from json import load
class Number:
NAME = 0
TEN_POWER_NAME = 1
def get_number_name(value, number_filename, lang=None, form=None, ten_pow_system=None):
num_names = []
with open(number_filename, 'r', encoding='utf-8') as fp:
@aleksas
aleksas / image_diff.py
Created April 5, 2019 13:46
Python script to output image of difference between two images
import cv2
import numpy as np
img0 = cv2.imread(r'in1.jpg', 0)
img1 = cv2.imread(r'in2.jpg', 0)
np_subtr = np.subtract(img0, img1)
np_mean = np.mean(np_subtr)
np_double_mean = np.mean(np_subtr)
@aleksas
aleksas / mkdirs_ftp.py
Created July 14, 2019 22:39
Function to create directories recursively.
from ftplib import FTP, FTP_TLS, error_perm
def cwd(ftp, path, ret=False):
def mkd_cwd(ftp, path):
if path != '':
try:
ftp.cwd(path)
except error_perm:
mkd_cwd(ftp, '/'.join(path.split('/')[:-1]))
try:
@aleksas
aleksas / docker-compose.yml
Last active August 25, 2019 22:00
Docker compopse for pyspider
mysql:
image: mysql:latest
volumes:
- /data/mysql:/var/lib/mysql
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
rabbitmq:
image: rabbitmq:latest
phantomjs:
image: binux/pyspider:latest
@aleksas
aleksas / FakeMultiSentimentImdb.py
Last active October 7, 2019 07:21
A tensor2tensor text multi labeling problem
# coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@aleksas
aleksas / SDL2Panel.cs
Last active October 22, 2019 14:51
C# SDL2 Panel control wrapping SDL2 window. Based on this snippet: https://gist.github.com/flibitijibibo/cf282bfccc1eaeb47550.
using SDL2;
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace DesktopApp1
{
class SDL2Panel : Panel
{
@aleksas
aleksas / elastic_python_server.py
Last active November 18, 2019 10:14
Simple python http server doing post queries to elasticsearch server
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
from urllib.parse import parse_qsl
from elasticsearch import Elasticsearch
form = '''
<form method="post" action=".">
<input type="text" name="query" value="%s">
<input type="submit" value="Submit">
@aleksas
aleksas / ffmpeg-0001-expose_internal_fns.patch
Last active December 23, 2019 14:08
Patch for FFMPEG build as explained in https://github.com/m-ab-s/media-autobuild_suite#custom-patches to expose some internal functions for custom filter building
libavfilter/avfilter.c | 5 +++++
libavfilter/avfilter.h | 3 +++
libavfilter/formats.c | 14 ++++++++++++--
libavfilter/formats.h | 6 ++++++
libavfilter/video.c | 5 +++++
libavfilter/video.h | 1 +
6 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index baafd029e9..03e8f3f674 100644