Skip to content

Instantly share code, notes, and snippets.

View crearo's full-sized avatar
🥨

Rish Bhardwaj crearo

🥨
View GitHub Profile
@crearo
crearo / nosql-optimize-reads
Last active May 28, 2023 07:29
Big no to NoSQL: This showcases how it optimizes either reads or writes. You can't do both.
{
"users": [
{
"_id": "user1",
"email": "[email protected]",
"name": "User One",
"gender": "male",
"friends": [
{
"_id": "user2",
@crearo
crearo / google-photos-add-exif.py
Last active June 27, 2021 18:20
Add Exif Tags to Google Photo via Drive Takeout
#!/usr/bin/python
"""
[ ] List out if there are images which have been missed. (ie, image was there, but no json file)
[ ] Put the images in various directories.
[ ] Add EXIF tags to each of the photos.
"""
import json
import os
import sys
@crearo
crearo / monthly_expenses.py
Last active August 4, 2020 21:14
Deutsche Bank CSV To Meaningful Analysis of Money Spent
"""
Converts Deutsche Bank's CSV of transactions to various categories to see what you're spending money on.
This isn't the neatest code I've written. But it gets what I need done.
I want to see how much I spend on various categories every month. That's it.
Output looks like:
2020-03-01 00:00:00 to 2020-03-31 00:00:00
essentials: -1275.2
@crearo
crearo / world.csv
Created August 23, 2019 09:47
Cities and Countries of the World Latitudes & Longitudes
United States Alabama 32.6010112 -86.6807365
United States Alaska 61.3025006 -158.7750198
United States Arizona 34.1682185 -111.930907
United States Arkansas 34.7519275 -92.1313784
United States California 37.2718745 -119.2704153
United States Colorado 38.9979339 -105.550567
United States Connecticut 41.5187835 -72.757507
United States Delaware 39.145251 -75.4189206
United States District of Columbia 38.8993487 -77.0145666
United States Florida 27.9757279 -83.8330166
@crearo
crearo / keras-preprocessing-bug.py
Created June 14, 2019 16:09
A bug in Keras where it resizes first and then applies the preprocessing function
'''
Keras's ImageDataGenerator is buggy. It first resizes based on `target_size`,
and then applies the preprocessing function you specified. This sucks.
Who wants that to happen anyway.
'''
def crop_image(img):
print(img.shape)
return img
@crearo
crearo / fastai-classify-max-in-list.py
Last active May 9, 2019 10:03
I've been trying to make a classifier that
"""
Note: I still need to work on the fastai api more to code this without a tabularlist.
-
I've been doing the fastai course and all the examples put up there are on complicated data - images, text, tables.
I wanted to take a seemingly simple problem of finding the maximum in a list.
I've only been able to get a 94% accuracy with whatever I've learnt so far. I thought it'd be an accurate 100%,
but maybe I'm just not deep enough into the course yet.
Note, I originally didn't want to classify, but make it a regression problem, but I wasn't able to use the fastai api
to do so. There's this `FloatList` option, but i can't seem to get it to work.
@crearo
crearo / Sublime Text: Eclipse Shortcuts keymap
Created May 5, 2019 08:12 — forked from Flet/gist:5447732
Sublime Text: Eclipse Shortcuts keymap
[
{ "keys": ["f12"], "command": "htmlprettify"},
{ "keys": ["f1"], "command": "fold" },
{ "keys": ["f2"], "command": "unfold" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
@crearo
crearo / .zshrc
Last active October 19, 2019 10:07
My .zshrc config file
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/rish/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@crearo
crearo / whatsapp-automater.py
Created June 3, 2018 13:14
Sends messages and calls a friend in a continuous loop to annoy them
#! /usr/bin/env python
'''
Created on June 3, 2018
@author: rish
This snippet sends messages or video calls a friend on Whatsapp.
This requires you to keep the Whatsapp chat page open for this to work.
'''
@crearo
crearo / image-resizer.py
Created May 4, 2018 07:41
resize-images-in-directory.py
#!/usr/bin/env python
'''
uses PIL to resize all images in a directory
'''
import Image
import os, sys
def resizeImage(infile, output_dir="", size=(640,480)):