Skip to content

Instantly share code, notes, and snippets.

View bcambel's full-sized avatar
🌴
On vacation

Bahadir Cambel bcambel

🌴
On vacation
View GitHub Profile
@bcambel
bcambel / ffmpeg.md
Created July 24, 2018 08:09 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@bcambel
bcambel / transform.js
Last active February 20, 2018 20:19
AWS Lambda Function example
'use strict';
console.log('Loading function');
exports.handler = (event, context, callback) => {
/*Print streams as source only data here*/
event.records.forEach((record) => {
console.log(record.kinesisRecordMetadata.sequenceNumber);
console.log(record.kinesisRecordMetadata.subsequenceNumber);
console.log(record.kinesisRecordMetadata.partitionKey);
console.log(record.kinesisRecordMetadata.shardId);
{
"StreamName": "$input.params('stream-name')"
}
{
"StreamDescription": {
"EncryptionType": "NONE",
"EnhancedMonitoring": [
{
"ShardLevelMetrics": []
}
],
"HasMoreShards": false,
"RetentionPeriodHours": 24,
@bcambel
bcambel / kinesis.js
Last active February 16, 2018 13:59
{
// the templates argument that will be replaced from the URL
// <api>/Stream/{stream-name}
"StreamName": "$input.params('stream-name')",
// Data that we received + a NEW LINE Base64 encoded (Cg==)
"Data": "$util.base64Encode($input.json('$.Data'))Cg==",
"PartitionKey": "$input.path('$.PartitionKey')"
}

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@bcambel
bcambel / steps.sh
Last active December 26, 2017 21:21 — forked from albertstartup/steps.sh
aws gpu, ubuntu 16.04, nvidia driver 367, cuda 8,
# Required downloads:
sudo wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_8.0.44-1_amd64.deb
# NVIDIA-Linux-x86_64-367.27.run
# cuda_8.0.27_linux.run
# cudnn-8.0-linux-x64-v5.0-ga.tgz
sudo apt-get install build-essential
sudo apt-get install linux-image-extra-`uname -r`
sudo ./NVIDIA-Linux-x86_64-367.27.run
./cuda_8.0.27_linux.run --extract=`pwd`/extracts
#!/bin/bash
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections; echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections creates=/usr/lib/jvm/java-8-oracle
sudo apt-get install oracle-java8-installer ca-certificates oracle-java8-set-default -y
@bcambel
bcambel / openresty.sh
Last active March 27, 2018 08:07
Open Resty Install script on Ubuntu 16.04
#!/bin/bash
VERSION="1.11.2.2"
wget https://openresty.org/download/openresty-${VERSION}.tar.gz
wget https://openresty.org/download/openresty-${VERSION}.tar.gz.asc
gpg --keyserver pgpkeys.mit.edu --recv-key A0E98066
gpg openresty-${VERSION}.tar.gz.asc
gpg openresty-${VERSION}.tar.gz.asc
tar -xvf openresty-${VERSION}
cd openresty-${VERSION}
sudo apt-get install build-essential libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl -y
(with-open [file-stream (FileInputStream. ten-gb-filename)]
(let [channel (chan 500)
;; make four workers to read byte arrays off the channel:
counters (for [_ (range 4)]
(go-loop [newline-count 0]
(let [barray (async/<! channel)]
(if (nil? barray) ;; channel is closed
newline-count
(recur (+ newline-count
(count-newlines barray)))))))]