Skip to content

Instantly share code, notes, and snippets.

View aleksas's full-sized avatar

Aleksas Pielikis aleksas

View GitHub Profile
@aleksas
aleksas / tapino_būdas.ipynb
Last active October 8, 2016 09:35 — forked from sirex/tapino_būdas.ipynb
2016 metų Seimo rinkimų kandidatų analizė
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// REFERENCES:
// http://ffmpeg.org/doxygen/trunk/doc_2examples_2decoding__encoding_8c-example.html
// https://blinkingblip.wordpress.com/2011/10/08/decoding-and-playing-an-audio-stream-using-libavcodec-libavformat-and-libao/
extern "C" {
#include <stdio.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <ao/ao.h>
@aleksas
aleksas / trim_and_combine_two_audio_files.sh
Last active December 15, 2021 20:15
FFMPEG trim silence from audio files and concatenate them with specified lengh silence interval.
#!/bin/sh
in_1_fname=./wavefile1.wav
in_2_fname=./wavefile2.wav
out_fname=./out.wav
threshold=-50dB
pause=1.5 # seconds
ffmpeg -loglevel verbose -y \
@aleksas
aleksas / Dockerfile
Created October 27, 2018 20:34
Tensorflow 1.4 CPU Dockerfile
FROM ubuntu:16.04
MAINTAINER Craig Citro <[email protected]>
# Pick up some TF dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
libfreetype6-dev \
libpng12-dev \
FROM tensorflow/tensorflow:1.12.0-devel-gpu-py3
RUN apt-get update /
&& apt-get install git -y
# TensorBoard
EXPOSE 6006
# IPython
EXPOSE 8888
This file has been truncated, but you can view the full file.
node {
name: "global_step/Initializer/zeros"
op: "Const"
attr {
key: "_class"
value {
list {
s: "loc:@global_step"
}
}
@aleksas
aleksas / TransformerEncoder.py
Created November 29, 2018 19:03
Use encoder part from Tensor2Tensor transformer
from tensor2tensor.models import transformer
import tensorflow as tf
hparams = transformer.transformer_base()
encoder = transformer.TransformerEncoder(hparams, mode=tf.estimator.ModeKeys.TRAIN)
#x = <your inputs, which should be of shape [batch_size, timesteps, 1, hparams.hidden_dim]>
#y = encoder({"inputs": x})
# model_fn_body(features)
@aleksas
aleksas / tensor2tensor_imdb_sentiment_analysis.sh
Last active December 3, 2018 07:59
Run imdb sentiment analysis
PROBLEM=sentiment_imdb_characters
MODEL=transformer_encoder
HPARAMS=transformer_base_single_gpu
DATA_DIR=$HOME/t2t_data
TMP_DIR=/tmp/t2t_datagen
TRAIN_DIR=$HOME/t2t_train/$PROBLEM/$MODEL-$HPARAMS
BATCH_SIZE=512
mkdir -p $DATA_DIR $TMP_DIR
PROBLEM=sentiment_imdb_characters
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
@aleksas
aleksas / make_video_from_audio.bat
Last active December 3, 2018 13:29
Batch script to make a video from image and audio file using one line of ffmpeg
@echo off
pushd %~dp0
set image_path="%CD%\BACKGROUND_IMAGE.jpg"
set output_video_path="%~dpn1.mp4"
echo "PREPARING OUTPUT: %output_video_path%"
ffmpeg -loop 1 -i "%image_path%" -i "%~1" -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest "%output_video_path%"