Skip to content

Instantly share code, notes, and snippets.

View oplatek's full-sized avatar

Ondřej Plátek oplatek

View GitHub Profile
@oplatek
oplatek / ffmpeg_installer
Created October 25, 2021 22:07 — forked from dhpollack/ffmpeg_installer
Simple Bash Script to Install FFMPEG + Required Libraries in Ubuntu 14.04
#!/bin/bash
# Bash Script to Install FFMPEG in Ubuntu 14.04
# Ref: http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
# Opsional: install exiftool: apt-get install libimage-exiftool-perl
#
# Author: Edi Septriyanto http://masedi.net <hi@masedi.net>
########################################################################
CURDIR=$(pwd)
@oplatek
oplatek / clean env
Last active November 2, 2020 10:17
ycm compilation macos clean environment
mboplatek:YouCompleteMe oplatek$ env
SHELL=/usr/local/bin/bash
XPC_FLAGS=0x0
TERM_PROGRAM_VERSION=433
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.XIpE0VAAVX/Listeners
TERM_SESSION_ID=C59A55E3-366C-4651-A75B-C5C0F8825111
PWD=/Users/oplatek/.vim/bundle/YouCompleteMe
LOGNAME=oplatek
LaunchInstanceID=580A1386-878E-47F0-A69F-1380E631C731
HOME=/Users/oplatek
@oplatek
oplatek / gist:ee74c27a8a12400c9282940cdedf3c9f
Created November 2, 2020 10:03
environment ycm debugging
SHELL=/usr/local/bin/bash
XPC_FLAGS=0x0
TERM_PROGRAM_VERSION=433
CONDA_EXE=/Users/oplatek/anaconda3/bin/conda
_CE_M=
TMUX=/private/tmp/tmux-501/default,7388,0
LANGUAGE=en_US.UTF-8
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.XIpE0VAAVX/Listeners
TERM_SESSION_ID=2A640EC8-E79E-485A-B850-BDE24A8DEB18
EDITOR=vim
@oplatek
oplatek / ycm_stdout_stderr.log
Created November 2, 2020 09:48
YCM compilation issue on macos
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/llvm-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/llvm-g++ - skipped
@oplatek
oplatek / curl-websocket.sh
Last active November 23, 2017 17:24 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@oplatek
oplatek / curl-websocket.sh
Created November 23, 2017 17:24 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@oplatek
oplatek / pcm_record.py
Created December 28, 2016 22:31
Record 16bit 16khz pcm from python
# coding: utf-8
import sounddevice as sd
duration = 10
fs = 16000
rec = sd.rec(duration * fs, samplerate=fs, channels=1, dtype='int16')
sd.wait()
pcm = rec.tostring()
with open('test.raw', 'wb') as w:
w.write(pcm)
@oplatek
oplatek / tmux_local_install.sh
Created October 15, 2016 19:51 — forked from petrbel/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.3
@oplatek
oplatek / install-tf-gpu-linux-and-test
Last active April 21, 2019 16:11
Installing Tensorflow 0.8 for GPU on Linux and test if GPU is used supported Python2.7 and 3.4
#!/bin/bash
[ -z $1 ] && python=3.4
if [ $(whoami) = root ] ; then
user=''
else
echo Not running under sudo. pip install --user
user='--user'
fi
if [ $python = '2.7' ] ; then
def lengths2mask2d(lengths, max_len):
batch_size = lengths.get_shape().as_list()[0]
# Filled the row of 2d array with lengths
lengths_transposed = tf.expand_dims(lengths, 1)
lengths_tiled = tf.tile(lengths_transposed, [1, max_len])
# Filled the rows of 2d array 0, 1, 2,..., max_len ranges
rng = tf.to_int64(tf.range(0, max_len, 1))
range_row = tf.expand_dims(rng, 0)
range_tiled = tf.tile(range_row, [batch_size, 1])