Skip to content

Instantly share code, notes, and snippets.

View idling-mind's full-sized avatar

Najeem Muhammed idling-mind

View GitHub Profile
@idling-mind
idling-mind / interpolate.py
Created August 20, 2017 16:18
Interpolation for a single point for x-y data from pandas dataframe
import pandas as pd
import numpy as np
mydata = pd.DataFrame({
"Temp":[10,20,30,40,50],
"Data":[123,323,335,567,886]
})
point_to_interpolate = 33
@idling-mind
idling-mind / README.md
Last active April 7, 2019 06:08
Setting up headless raspberry pi

Setting up a headless raspberry pi on wifi network

Things required

  1. Raspberry pi (Tested on pi-zero-w and pi-3)
  2. Raspbian stretch lite (Download)
  3. Micro SD card (8 GB or more)
  4. A computer with SD card reader connected to wifi
  5. Etcher (Download)

Steps

import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/photoslibrary.readonly']
creds = None
items = []
nextpagetoken = None
# The default number of media items to return at a time is 25. The maximum pageSize is 100.
while nextpagetoken != '':
print(f"Number of items processed:{len(items)}", end='\r')
results = google_photos.mediaItems().list(pageSize=100, pageToken=nextpagetoken).execute()
items += results.get('mediaItems', [])
nextpagetoken = results.get('nextPageToken', '')
import pandas as pd
# Convert the list of dict into a dataframe.
df = pd.DataFrame(items)
# Taking the column mediaMetadata and splitting it into individual columns
dfmeta = df.mediaMetadata.apply(pd.Series)
# Combining all the different columns into one final dataframe
photos = pd.concat(
[
# Convert the creation time to a datetime dtype
photos.creationTime = pd.to_datetime(photos.creationTime)
# Convert other numeric data into numeric dtypes
for c in ['width', 'height', 'apertureFNumber', 'focalLength', 'isoEquivalent']:
photos[c] = pd.to_numeric(photos[c])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@idling-mind
idling-mind / pilwall_basic.py
Created July 29, 2020 12:41
Drawing basic circle in PIL
from PIL import Image, ImageDraw
img = Image.new("RGB", (500, 500))
ic = ImageDraw.Draw(img)
ic.ellipse([0, 0, 500, 500], fill="RED")
img.save("basic.png")