Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
bkamapantula / README.md
Created March 27, 2021 11:58
Get live chat content from YouTube videos

Setup

pytchat

Install pytchat which does bulk of the work. Open a terminal and run the below to install pytchat.

pip install pytchat
@bkamapantula
bkamapantula / qgis-add-layers.py
Created November 28, 2020 02:18
Import and export several files - QGIS
"""
Add several CSV files as Delimited Text Layer(s) with x coordinate as Longitude and y as Lattitude.
This script is adapted from https://chris35wills.github.io/multi_csv_into_qgis/.
Updated `addAttributeAlias` to `setFieldAlias` as it's renamed.
"""
import os.path, glob
layers = []
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"padding": 5,
"width": 400,
"height": 300,
"data": [
{
"name": "table",
"url": "https://raw.githubusercontent.com/deldersveld/topojson/master/countries/france/fr-departments.json",
"format": {"type": "topojson", "feature": "FRA_adm2"}
@bkamapantula
bkamapantula / vega-lite-sort-bars-spec.json
Created August 18, 2020 05:28
Sort bars in vega-lite
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.json",
"description": "Bar chart with text labels. Apply scale padding to make the frame cover the labels.",
"data": {
"values": [
{"Metrics": "A1", "Percentage": 0.79},
{"Metrics": "A2", "Percentage": 0.0399},
{"Metrics": "A3", "Percentage": 0.9868},
{"Metrics": "A4", "Percentage": 0.0536},
{"Metrics": "A5", "Percentage": 0.9412},
@bkamapantula
bkamapantula / kibana.md
Created July 21, 2020 03:04
Working with Kibana, the first time

Kibana with nginx logs

I wanted to explore Kibana to analyze nginx logs. Finding the right place to work with data seemed unnecessarily complex.

I had to visit Visualization under Machine Learning to upload a file!

  1. Cloning sample dataset for quick views is easy.
  2. Importing data files into Kibana is a breeze.
  3. We capture timestamp in nginx logs. But Kibana seemed to have trouble recognizing it and picking a right timestamp format.
@bkamapantula
bkamapantula / README.md
Created June 9, 2020 15:22
Created with Gramex Charts. Visit at https://gramener.com/gramexcharts

Horizontal bar chart

@bkamapantula
bkamapantula / README.md
Created June 9, 2020 12:05
Created with Gramex Charts. Visit at https://gramener.com/gramexcharts

New chart

@bkamapantula
bkamapantula / README.md
Created June 1, 2020 09:58
Created with Gramex Charts. Visit at https://gramener.com/gramexcharts

New chart

@bkamapantula
bkamapantula / README.md
Created May 27, 2020 16:33
Created with Gramex Charts. Visit at https://gramener.com/gramexcharts

New chart