Skip to content

Instantly share code, notes, and snippets.

View pratos's full-sized avatar
🎯
Focusing

prthamesh pratos

🎯
Focusing
View GitHub Profile
@stepney141
stepney141 / BookmarkAPI_en.md
Last active April 4, 2023 01:45
(DEPRECATED) Twitter Undocumented Endpoints for Bookmark
@dmmeteo
dmmeteo / 1.srp.py
Last active April 27, 2024 05:48
SOLID Principles explained in Python with examples.
"""
Single Responsibility Principle
“…You had one job” — Loki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
"""
class Animal:
def __init__(self, name: str):
@avsthiago
avsthiago / Data_augmentation_keras_opencv_brightness_hsv.py
Created April 8, 2018 17:58
Data augmentation using Keras ImageDataGenerator and OpenCV. Also with brightness augmentation.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 09:57:55 2018
@author: avsthiago
"""
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
@rubyconvict
rubyconvict / bulk_reindexer.rb
Last active February 15, 2023 21:42 — forked from VvanGemert/bulk_reindexer.rb
Asynchronous bulk reindexing module for Searchkick with Sidekiq
# https://medium.com/rubyinside/asynchronous-elasticsearch-bulk-reindexing-with-rails-searchkick-and-sidekiq-26f2f9aa8513
# https://github.com/ankane/searchkick
# 2.3.2 [unreleased]
# - Added wait option to async reindex
# Searchkick.reindex(async: {wait: true})
# This code has been ported to searchkick.
require 'sidekiq/api'
# BulkReindexer
module BulkReindexer
@kevinzakka
kevinzakka / data_loader.py
Last active April 19, 2024 23:42
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brianshumate
brianshumate / docker-macos-terraform.md
Last active April 16, 2024 02:18
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@orenitamar
orenitamar / Dockerfile
Last active March 22, 2024 05:13
Installing numpy, scipy, pandas and matplotlib in Alpine (Docker)
# Below are the dependencies required for installing the common combination of numpy, scipy, pandas and matplotlib
# in an Alpine based Docker image.
FROM alpine:3.4
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk --no-cache --update-cache add gcc gfortran python python-dev py-pip build-base wget freetype-dev libpng-dev openblas-dev
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
RUN pip install numpy scipy pandas matplotlib
@joseph-zhong
joseph-zhong / BUILD_AWS_LAMBDA.md
Last active March 26, 2019 21:11 — forked from mmitou/how-to-build-opencv3.0.0-for-aws-lambda.md
Building OpenCV for AWS Lambda Python

To build OpenCV3.0 for AWS Lambda Python

Summary

Because AWS Lambda runs in a Amazon Linux environment, to run external modules you must

Create the OpenCV build environment

sudo yum update -y
@soply
soply / disp_multiple_images.py
Last active January 9, 2024 14:52
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.