Skip to content

Instantly share code, notes, and snippets.

View gnsx's full-sized avatar

Kevin D'Souza gnsx

View GitHub Profile
@gnsx
gnsx / go-sort-map.go
Created February 15, 2019 11:23 — forked from flaviocopes/go-sort-map.go
Go: sort a Map by key #golang
import "sort"
ages := map[string]int{
"a": 1,
"c": 3,
"d": 4,
"b": 2,
}
names := make([]string, 0, len(ages))
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@gnsx
gnsx / pg.go
Created October 17, 2018 08:17 — forked from itang/pg.go
golang + postgreSQL example
package main
import (
"database/sql"
"fmt"
"log"
// load postgres driver
_ "github.com/lib/pq"
)
@gnsx
gnsx / ffmpeg_opencv.py
Created July 21, 2017 18:40 — forked from eruffaldi/ffmpeg_opencv.py
Feeding Python Opencv with FFmpeg
#
# Reading video from FFMPEG using subprocess - aka when OpenCV VideoCapture fails
#
# 2017 note: I have realized that this is similar to moviepy ffmpeg reader with the difference that here we support YUV encoding
# BUT we lack: bufsize in POpen and creation flags for windows
# https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/ffmpeg_reader.py
#
# Emanuele Ruffaldi 2016
import cv2
import subprocess