Skip to content

Instantly share code, notes, and snippets.

View zequequiel's full-sized avatar

Ezequiel Arceo May zequequiel

  • MathHow
  • Buctzotz Yucatán, México
View GitHub Profile
from io import BytesIO
import base64
import gzip
import json
def gzip_b64encode(data):
compressed = BytesIO()
with gzip.GzipFile(fileobj=compressed, mode='w') as f:
json_response = json.dumps(data)
@zequequiel
zequequiel / simple_args_parsing.sh
Created January 21, 2020 20:33 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@zequequiel
zequequiel / local_maxima.py
Created May 15, 2019 01:54 — forked from ben741/local_maxima.py
Find indices of local minima and maxima of a numpy array
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace (0, 50, 1000)
y = 0.75 * np.sin(x)
peaks = np.where((y[1:-1] > y[0:-2]) * (y[1:-1] > y[2:]))[0] + 1
dips = np.where((y[1:-1] < y[0:-2]) * (y[1:-1] < y[2:]))[0] + 1
# The above makes a list of all indices where the value of y[i] is greater than both of its neighbours
@zequequiel
zequequiel / test.py
Created December 24, 2018 22:38 — forked from qlkvg/test.py
viewing depth map from openni2 compatible device with opencv2
#!/usr/bin/python
import cv2
import numpy as np
from primesense import openni2
from primesense import _openni2 as c_api
openni2.initialize("<PATH TO OPENNI2 REDIST FOLDER>")
dev = openni2.Device.open_any()
depth_stream = dev.create_depth_stream()
depth_stream.start()
depth_stream.set_video_mode(c_api.OniVideoMode(pixelFormat = c_api.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_100_UM, resolutionX = 640, resolutionY = 480, fps = 30))
@zequequiel
zequequiel / camera.py
Created December 20, 2018 02:00 — forked from joinAero/camera.py
Use Kinect with OpenCV (Python)
import cv2
import sys
class Camera(object):
def __init__(self, index=0):
self.cap = cv2.VideoCapture(index)
self.openni = index in (cv2.CAP_OPENNI, cv2.CAP_OPENNI2)
self.fps = 0
@zequequiel
zequequiel / watcher_handler.py
Created August 18, 2018 06:25 — forked from caseyanderson/watcher_handler.py
watches a directory for file events and responds with handler
'''
watcher and handler
to install watchdog for python3: pip3 install watchdog
sourced from https://www.michaelcho.me/article/using-pythons-watchdog-to-monitor-changes-to-a-directory
'''
import time
from watchdog.observers import Observer
@zequequiel
zequequiel / react-form-set-state-input-and-submit.js
Created July 22, 2018 17:26 — forked from stowball/react-form-set-state-input-and-submit.js
React. Form with dynamic inputs that setState for values and submit
class Form extends Component {
state = {};
renderInput = (name, type, value='') =>
<input onChange={({target}) => this.setState({[name]: target.value})} name={name} type={type} value={this.state[name] || value}/>;
handleSubmit = (evt) => {
evt.preventDefault();
send('/form', this.state);
}
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@zequequiel
zequequiel / LICENCE SUBLIME TEXT
Created November 3, 2017 17:16
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA