Skip to content

Instantly share code, notes, and snippets.

View stanlee321's full-sized avatar

Stanley Salvatierra stanlee321

View GitHub Profile
@mesmacosta
mesmacosta / Dockerfile
Created November 28, 2019 17:30
Docker alpine python + grpc
FROM python:3.7-alpine as base
# install gcc and grpc dependencies
FROM base as builder
RUN apk add --update --no-cache \
gcc \
linux-headers \
make \
musl-dev \
python-dev \
@GerardBCN
GerardBCN / stock_price_autoencoding.ipynb
Created January 18, 2019 21:15
Stock market Bitcoin data compression with autoencoders
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeremyjordan
jeremyjordan / sgdr.py
Last active December 4, 2023 13:41
Keras Callback for implementing Stochastic Gradient Descent with Restarts
from keras.callbacks import Callback
import keras.backend as K
import numpy as np
class SGDRScheduler(Callback):
'''Cosine annealing learning rate scheduler with periodic restarts.
# Usage
```python
schedule = SGDRScheduler(min_lr=1e-5,
@dkurzaj
dkurzaj / README.md
Last active April 3, 2023 06:54
Docker compose Kafka, Zookeeper and Kafka manager

Docker compose Kafka, Zookeeper and Kafka manager

Gist inspired by this one intending to be an updated version of it : https://gist.github.com/17twenty/d619f922ab209f750630824f7c6836e3

Install

  • Create the environment variable that contains our host name (IP address) :
$ export EXPOSED_HOSTNAME=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1  -d'/')
  • Create the folders :
@ariffyasri
ariffyasri / rem_outlier.py
Created December 11, 2017 01:13
Remove outliers in pandas
import pandas as pd
import numpy as np
from pandas.api.types import is_numeric_dtype
np.random.seed(42)
age = np.random.randint(20,100,50)
name = ['name'+str(i) for i in range(50)]
address = ['address'+str(i) for i in range(50)]
@CarlosGS
CarlosGS / raspberry_fast_capture.py
Last active February 26, 2024 04:16
Fast reading from the raspberry camera with Python, Numpy, and OpenCV. See the comments for more details.
# Fast reading from the raspberry camera with Python, Numpy, and OpenCV
# Allows to process grayscale video up to 124 FPS (tested in Raspberry Zero Wifi with V2.1 camera)
#
# Made by @CarlosGS in May 2017
# Club de Robotica - Universidad Autonoma de Madrid
# http://crm.ii.uam.es/
# License: Public Domain, attribution appreciated
import cv2
import numpy as np
@kylehounslow
kylehounslow / client.py
Last active April 23, 2024 10:58
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@stanlee321
stanlee321 / fft_convolution.py
Created April 17, 2017 20:03 — forked from thearn/fft_convolution.py
1D and 2D FFT-based convolution functions in Python, using numpy.fft
from numpy.fft import fft, ifft, fft2, ifft2, fftshift
import numpy as np
def fft_convolve2d(x,y):
""" 2D convolution, using FFT"""
fr = fft2(x)
fr2 = fft2(np.flipud(np.fliplr(y)))
m,n = fr.shape
cc = np.real(ifft2(fr*fr2))
cc = np.roll(cc, -m/2+1,axis=0)
@stared
stared / live_loss_plot_keras.ipynb
Last active February 25, 2023 10:20
Live loss plot for training models in Keras (see: https://github.com/stared/livelossplot/ for a library)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zainengineer
zainengineer / container_ip.bash
Last active February 2, 2023 21:20
Get docker container ip
#!/usr/bin/env bash
#inside docker container
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
CONTAINER_IP=$(curl "$HOST_IP:8000" 2>/dev/null)
echo "container ip is $CONTAINER_IP"