Skip to content

Instantly share code, notes, and snippets.

View ozgurgul's full-sized avatar

Ozgur Gul ozgurgul

  • London, England
View GitHub Profile
@ozgurgul
ozgurgul / airflow-python3.sh
Created February 25, 2020 08:09 — forked from zacgx/airflow-python3.sh
Installing Airflow with CeleryExcuter, using PostgreSQL as metadata database and Redis for Celery message broker
# this script has been tested and worked in a freshly installed Ubuntu 16.04 and 16.10
# it assumes that you are running airflow in a private netowrk and no need to be worry about outside access
# if that's not the case, the lines for PostgreSQL and Redis in this script need to be updated accordingly
# run as root
sudo su
# initial system updates and installs
apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean
apt-get -y install build-essential binutils gcc make git htop nethogs tmux
https://airflow.readthedocs.io/en/latest/start.html
sudo apt-get install python3-pip
sudo apt-get install postgresql postgresql-contrib
sudo -u postgres createuser --interactive
name: airflow
superuser: yes
@ozgurgul
ozgurgul / airflow-quick-start.sh
Created May 22, 2020 13:46 — forked from mmziyad/airflow-quick-start.sh
A really quick on-boarding for Apache airflow.
# install
mkdir ~/airflow
cd ~/airflow
pip install airflow
# Have a look here if you need additional packages: https://airflow.incubator.apache.org/installation.html
# setup mysql backend as given here. The default SQLite is not adequate for some workloads.
# http://site.clairvoyantsoft.com/installing-and-configuring-apache-airflow/
# start services
@ozgurgul
ozgurgul / stripNonAlphaNum.py
Created June 4, 2020 20:47 — forked from acrymble/stripNonAlphaNum.py
Strip Non Alpha-Numeric
# Given a text string, remove all non-alphanumeric
# characters (using Unicode definition of alphanumeric).
def stripNonAlphaNum(text):
import re
return re.compile(r'\W+', re.UNICODE).split(text)
@ozgurgul
ozgurgul / mpeg-dash-ffmpeg-dashjs.md
Created June 8, 2020 16:17 — forked from kevinGodell/mpeg-dash-ffmpeg-dashjs.md
Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.

Live streaming mpeg-dash video using ffmpeg and dash.js

Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.

Prerequisites

A linux server, such as Ubuntu

Apache web server installed, running, and reachable via its ip address
@ozgurgul
ozgurgul / setup_airflow_auth.py
Created June 10, 2020 23:35 — forked from nehiljain/setup_airflow_auth.py
A script to automatically setup a admin user for airflow which can be run at infrastructure setup time.
import os
import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
def create_admin_user(uname, pwd, email):
user = PasswordUser(models.User())
user.username = uname
user.email = email
@ozgurgul
ozgurgul / ffmpeg-convert-mp3-to-wave
Created June 24, 2020 16:22 — forked from vunb/ffmpeg-convert-mp3-to-wave
Convert mp3 to wave format using ffmpeg
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav
# To convert all mp3 files in a directory in Linux:
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done
# Or Windows:
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav

ON MASTER

$ yum install mariadb-server
$ systemctl restart mariadb
$ systemctl enable mariadb
$ mysql_secure_installation

On /etc/my.cnf, add

@ozgurgul
ozgurgul / flask-mysql-redis-celery.md
Created July 14, 2020 10:03 — forked from bluekvirus/flask-mysql-redis-celery.md
# Develop a Flask Application using MariaDB, Redis and Celery on Ubuntu 14.04+

Develop a Flask Application using MariaDB, Redis and Celery on Ubuntu 14.04

@credit Yan Zhu (https://github.com/nina-zhu)

Introduction

Before you start this guide, you should run through the "How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04" guide. This is necessary in order to set up virtualenv, uWSGI and Nginx. In that guide, we developed a very simple flask application having just 1 file "firstflask.py" with only 9 lines of code, it is a sample for showing you the general steps. In this guide, we will create a complete user session listing application, with login, logout functionality. We will use MariaDB to store the users records, and use Redis to store the session data and background tasks.

Let's get started.

Set Up the MariaDB Server

@ozgurgul
ozgurgul / ssh-info-docker-vm-windows.sh
Created October 22, 2020 11:32 — forked from jongio/ssh-info-docker-vm-windows.sh
It's not technically SSH, but here's how you can get root access to the VM that runs Docker on your Windows host.
docker run --privileged -it -v /var/run/docker.sock:/var/run/docker.sock jongallant/ubuntu-docker-client
docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
chroot /host