Skip to content

Instantly share code, notes, and snippets.

View t27's full-sized avatar

Tarang Shah t27

View GitHub Profile
@t27
t27 / find-duplicates-query.sql
Last active July 2, 2019 11:29
Find rows in a table that have duplicate values for columns x,y,z,w. Also optionally aggregate another column.
--Postgres
--just find duplicates
select col1,col2,col3,col4,col5,count(*) from my_table group by 1,2,3,4,5,6 HAVING count(*)>1
-- find duplicates and aggregate Ids, so that you can save one and delete the rest ('id' is a column in the table)
select col1,col2,col3,col4,col5,count(*), string_agg(id::character varying, ';' order by sign_code) from my_table group by 1,2,3,4,5,6 HAVING count(*)>1
@t27
t27 / run-in-browser-console.js
Created June 8, 2019 09:14
Tensorboard JS command to open all image sections in image previews
document.querySelectorAll('#center > div > tf-category-pane > button').forEach(e=>e.click())
// just copy the above and run in browser console to open all the image previews in a Tensorboard.
// Especially useful if youre logging image visualisations(for eg. detections in an object detector model)
@t27
t27 / .zprezto
Last active July 14, 2021 04:13
zprezto backup
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
#
# General
#
@t27
t27 / parse_tensorboard_eval_files.py
Created March 25, 2019 05:18
Parse the tensorboard files generated during evaluation for the TensorFlow object detection API
from tensorboard.backend.event_processing import event_accumulator
import json
eval_log_file_path = "path/to/events.out.tfevents.1555555555.0.0.0.0"
def modelEvalPathParser(path_to_eval_log):
ea = event_accumulator.EventAccumulator(path_to_eval_log)
ea.Reload()
jsonresult = {}
csvresult = "classname,ap\n"
@t27
t27 / visualise_tfrecord.ipynb
Last active November 18, 2020 07:36
Visualize a TFRecord for Tensorflow Object Detection Library
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@t27
t27 / cmd.sh
Created February 18, 2019 15:30
Command to rename files for windows friendly filenames
# need to install `rename`
find /path/to/directory -depth -exec rename 's/[<>:"\\|?*]/_/g' {} +
@t27
t27 / setting-up-toco-on-mac.md
Created October 22, 2018 09:44
Setting up toco on a mac

Setting up TOCO on macOS

Steps

  1. Install bazel
brew tap bazelbuild/tap
brew tap-pin bazelbuild/tap
brew install bazel
@t27
t27 / count-files-by-extension.sh
Created September 18, 2018 18:51
List the count of files in a folder by the extension
#List files by extension
# from https://unix.stackexchange.com/a/18508/
#find <folder> -type f | sed 's/.*\.//' | sort | uniq -c
find DEU/ -type f | sed 's/.*\.//' | sort | uniq -c
@t27
t27 / index.html
Last active August 24, 2018 05:10 — forked from d3noob/.block
Sankey from csv with d3.js
<!DOCTYPE html>
<meta charset="utf-8">
<title>SANKEY Experiment</title>
<style>
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
@t27
t27 / parallel_python.py
Last active April 21, 2020 12:45
Script to show sample code(boilerplate) for concurrent execution using concurrent.futures.ThreadPoolExecutor in python 3 (mainly IO operations like network calls, ie. HTTP etc)
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
Thread_pool = ThreadPoolExecutor(6) # can change 6 to any number
def sample_sum_func(arg1,arg2):
print("start",arg1,arg2)
time.sleep(2)
print("end",arg1,arg2)