Skip to content

Instantly share code, notes, and snippets.

View sudevschiz's full-sized avatar
🎯
Focusing

Sudev sudevschiz

🎯
Focusing
  • Soon enough!
  • Tokyo, Japan
View GitHub Profile
@sudevschiz
sudevschiz / copy_to_gcloud_vm.sh
Created September 4, 2018 07:19
Copy files from local (Windows or linux) to a VM in google cloud compute engine
#Easy way is to navigate to the folder where your file/folders lie and then -
gcloud compute scp FILENAME sudevchirappat@gcmbox:"/home/sudevchirappat/"
#Note : change FILENAME to the file you need upload
#If an entire folder needs to be moved use the recursion flag.
gcloud compute scp --recurse FOLDERNAME sudevchirappat@gcmbox:"/home/sudevchirappat/"
@sudevschiz
sudevschiz / feed_fish.py
Created December 28, 2022 15:26
Gist to control the servo connected to Raspberry Pi that feeds the fishes at specific time and notify by telegram
import pigpio
from time import sleep, strftime
from telegram.ext import Updater
BOT_TOKEN = ""
CHAT_ID = ""
# Pin
PIN = 17
@sudevschiz
sudevschiz / distance_between_zipcodes.py
Created January 29, 2016 07:04
Python script to find distance between two zipcodes. May use Google or Bing APIs
import urllib2
import csv
import json
import time
#Output file
out_file = open('distance_output.csv','a')
i = 0
@sudevschiz
sudevschiz / build_raw_data.py
Last active August 13, 2020 10:21
Concats all raw_data files with cleaning steps. Compares with the gospel to output the differences.
import pandas as pd # pylint: disable=import-error
import re
from pathlib import Path
import logging
import sys
import os
from urllib.error import HTTPError
# Set logging level
logging.basicConfig(stream=sys.stdout,
format="%(message)s",
@sudevschiz
sudevschiz / query_results.txt
Created July 25, 2020 16:53
Twitter results
(#AndamanFightsCOVID19) (from:ChetanSanghi)
------------------------------
(COVID-19 OR patients OR recovered OR discharged OR Active) (from:Andaman_admin)
------------------------------
***
http://twitter.com/Andaman_Admin/status/1287044453862055936
from datetime import datetime
import pandas as pd
import numpy as np
# Read merged data
df = pd.read_csv('https://api.covid19india.org/csv/latest/raw_data.csv')
df.head()
df['Date Announced'] = pd.to_datetime(df['Date Announced'])
df = df[df['Date Announced'] <= '2020-04-26']
df['District_Key'] = df['State code'] + "_" + df['Detected District']
@sudevschiz
sudevschiz / vision_response
Created June 20, 2020 08:39
vision_response
label_annotations {
mid: "/m/0fbf1m"
description: "Terrestrial animal"
score: 0.993838369846344
topicality: 0.993838369846344
}
label_annotations {
mid: "/m/03bk1"
description: "Giraffe"
score: 0.9926815032958984
@sudevschiz
sudevschiz / fetch_raw_data.py
Created March 30, 2020 10:41
Raw data from api.covid19india.org
import requests
import pandas as pd
r = requests.get("https://api.covid19india.org/raw_data.json")
pdb = r.json()
df = pd.DataFrame.from_dict(pdb['raw_data'])
@sudevschiz
sudevschiz / time_wise_update.gs
Created March 26, 2020 10:15
In Google Scripts : Fetch data from an API, compare some change and update last updated time
function time_wise_update(){
var getSheet = SpreadsheetApp.getActive().getSheetByName("Sheet1");
var setSheet = SpreadsheetApp.getActive().getSheetByName("Sheet2");
var url = 'https://xxx/data.json';
var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
var json = response.getContentText();
var data = JSON.parse(json);
var ss = data.ss;
@sudevschiz
sudevschiz / rand_color_gen.py
Created November 27, 2019 06:38
Generate list of N random HEX values, which can be used as coloring palettes in plotting libaries
def rand_color_gen(n=1):
h_v = []
for i in range(0,n):
i+=1
r = lambda: random.randint(0,255)
h_v.append('#%02X%02X%02X' % (r(),r(),r()))
return h_v
# Just random colors. No guarantee of any sort.