Skip to content

Instantly share code, notes, and snippets.

View ChakshuGautam's full-sized avatar
😁

Chakshu Gautam ChakshuGautam

😁
View GitHub Profile
@ChakshuGautam
ChakshuGautam / savedataGPS.py
Created September 14, 2016 07:08
Saving GPS data from vendor to database.
import socket
import sys
from thread import *
import urllib2
import json
import psycopg2
import datetime
# open the database in psql and type the following commands to create a database

These are notes while researching a way to convert a browser/website to a stream. This could be used for Facebook Live or for webrecording. TL'DR:

  • I started with Phantomjs - but that didn't support the html5 video tag
  • SlimerJS supports it, but there is no way to record audio directly (though this might come from desktop audio)
  • So I moved to research ffmpeg/X11/XVFB to record it with linux which works
  • But ffmpeg has no easy way to mix streams/overlays to I moved on to OBS with overlay browser support
  • I started researching options OBS in docker and it needed best a GPU , so I move to nvidia-docker
  • And so came across building game servers on EC2/AWS using GPUs and managed to run OBS inside of GPU g2x.large machine
  • I tried streaming to twich , which works great and managed to restream 4K 60FPS youtube on an AWS instance
  • Remote control works through OBS-Remote but OBS has kinda limit in types of features
@ChakshuGautam
ChakshuGautam / Procfile
Created October 24, 2018 17:47 — forked from ellefsen/Procfile
Heroku with Google Cloud SQL and cloud_sql_proxy with PHP / Laravel
web: (bash ./start.sh) & vendor/bin/heroku-php-nginx public/
@ChakshuGautam
ChakshuGautam / fileDownlaod.py
Last active November 20, 2018 07:32
Download IMDB files and save them in a directory.
import asyncio
from contextlib import closing
import aiohttp
import aiofiles
async def download_file(session: aiohttp.ClientSession, url: str):
async with session.get(url) as response:
assert response.status == 200
print("Started saving file: ", url.split('/')[-1])
f = await aiofiles.open(url.split('/')[-1], mode='wb')
@ChakshuGautam
ChakshuGautam / psql-setup-docker.sh
Last active October 23, 2019 05:47
PSQL Docker setup - Cheatbook
# Setup docker engine
# -p 127.0.0.1:5432:5432 instead of -p 5432:5432. If you don’t explicitly tell it to run on localhost, it’ll run on0.0.0.0 which means other folks on the same network will be able to reach it.
# https://hub.docker.com/_/postgres => Gives a lot of info regarding docker secrets which should be the way forward.
docker pull postgres
mkdir -p $HOME/docker/volumes/postgres
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 127.0.0.1:5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
@ChakshuGautam
ChakshuGautam / docker-install-do.sh
Created June 11, 2019 05:00
Install docker on digitalocean
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker
@ChakshuGautam
ChakshuGautam / nginx-install-do.sh
Created June 11, 2019 05:22
Install nginx and
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
@ChakshuGautam
ChakshuGautam / puppeteer-install-ubuntu.sh
Created June 13, 2019 10:28
Install puppeteer on ubuntu
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && apt update && apt install yarn
apt-get update && apt-get install -y wget --no-install-recommends && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && apt-get update && apt-get install -y google-chrome-stable ttf-mscorefonts-installer fonts-freefont-ttf fonts-ubuntu-font-family-console ttf-ubuntu-font-family edubuntu-fonts fonts-ubuntu-title fonts-liberation --no-install-recommends && rm -rf /var/lib/apt/lists/* && rm -rf /src/*.deb
apt-get update && apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx1
@ChakshuGautam
ChakshuGautam / MetabaseFix.md
Last active October 10, 2019 09:00
Process to follow when Metabase fails

Issue 1: Too big H2 database

This is mostly due to H2 database getting too big. So it doesn't load in 5 seconds. You can debug this using

docker logs b4f559dc829b --tail 100

If it is too big you will need to defrag it.

Text Editor Shortcuts

  • Multiple Cursors: cmd + opt+ shift + ⬇/⬆