Skip to content

Instantly share code, notes, and snippets.

@rambattu
rambattu / A-Wildlife-Trade-Analysis.md
Last active May 15, 2020 06:16
Wildlife trade analysis using Python

In this post we will see how to use Python for data analysis using a dataset of Wildlife Trade hosted by CITES.

The full dataset that contains data for all the trades recorded is available here https://trade.cites.org/en/cites_trade/# , but that is 237 MB in size. To get an idea of how to approach data and how to process it to get useful information out of it we can work with smaller dataset first.

In the web page referenced above, I selected the:

  • Year Range: 2015 to 2019
  • Search by Taxon: Elephantidae (Elephants)

After selecting those parameters, I clicked on Search which took me to a new page where the Report is ready.

@rambattu
rambattu / git-diff-to-svn-patch.md
Created February 28, 2020 03:59
Shell script to convert git diff into svn patch

Slight modification of the gist here https://gist.github.com/katta/1028871, that script works with the diff that got generated from git using --no-prefix, this script git-diff-to-svn-patch.sh can be used to work on diff that is generated without "--no-prefix" option as well

@rambattu
rambattu / README.md
Created August 9, 2019 20:59
protobuf-c 1.3.1 issue with PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE

Software versions:

  • Protobuf - 3.6.1
  • Protobuf-c - 1.3.1

Commands ran:

$protoc --c_out=. enum_int_test.proto . 

$ gcc enum_int_test.c  
In file included from enum_int_test.pb-c.h:7:0, 
sbattu-mbp:antidote-selfmedicate sbattu$ kubectl describe pods --namespace 25-66n1ihh28m8yslto-ns
Name: linux
Namespace: 25-66n1ihh28m8yslto-ns
Priority: 0
PriorityClassName: <none>
Node: minikube/10.0.2.15
Start Time: Wed, 19 Jun 2019 22:39:55 -0700
Labels: endpointType=UTILITY
lessonId=25
podName=linux
@rambattu
rambattu / describe-pods.txt
Created June 19, 2019 06:17
describe-pods.txt
sbattu-mbp:antidote-selfmedicate sbattu$ cat describe_pods.txt
Name: antidote-web-57f98b78d4-f5vg9
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/10.0.2.15
Start Time: Sat, 18 May 2019 18:07:19 -0700
Labels: antidote_role=infra
app=antidote-web
pod-template-hash=57f98b78d4
@rambattu
rambattu / syringe-logs.txt
Created June 13, 2019 17:31
syringe-logs
sbattu-mbp:antidote-selfmedicate sbattu$ kubectl logs syringe-6ffd7b7ccc-x4ts9
time="2019-06-13T17:21:12Z" level=info msg="syringed (dev-c3ff62da1f1fbd2af84a2b65cd7e87ef6cf53307) starting."
time="2019-06-13T17:21:12Z" level=debug msg="Syringe config: {\"CurriculumDir\":\"/antidote\",\"Tier\":\"local\",\"Domain\":\"antidote-local\",\"GRPCPort\":50099,\"HTTPPort\":8086,\"DeviceGCAge\":0,\"NonDeviceGCAge\":0,\"HealthCheckInterval\":0,\"TSDBExportInterval\":0,\"TSDBEnabled\":false,\"LiveLessonTTL\":30,\"CurriculumLocal\":false,\"CurriculumRepoRemote\":\"https://github.com/nre-learning/nrelabs-curriculum.git\",\"CurriculumRepoBranch\":\"master\"}"
time="2019-06-13T17:21:12Z" level=debug msg="Searching /antidote/collections for collection definitions"
time="2019-06-13T17:21:12Z" level=debug msg="Found collection definition at: /antidote/collections/cumulus/collection.meta.yaml"
time="2019-06-13T17:21:12Z" level=debug msg="Found collection definition at: /antidote/collections/gdt/collection.meta.yaml"
time="2019-06
@rambattu
rambattu / nestedJsonParse.go
Last active March 23, 2019 17:32
Go nested JSON parsing
package main
import (
"encoding/json"
"fmt"
"log"
)
type DataMap struct {
Data string `json:"data"`
@rambattu
rambattu / tile.js
Last active November 7, 2017 06:35
Random arrangement of an array
values = [1,1,2,2,5,3,3,4,4]
op = [-1,0,1]
values.sort(function(a,b){ return op[Math.floor(Math.random()*op.length)] })