Skip to content

Instantly share code, notes, and snippets.

View ocampor's full-sized avatar
🎯
Focusing

Ricardo Ocampo ocampor

🎯
Focusing
View GitHub Profile
## Get latency of service
repeat 1000; curl --output /dev/null --silent --write-out '%{time_total} %{http_code}\n' localhost:7575/healthcheck && sleep 5
## Get file name from path
basename "${path_sample}
## For each path.
find "${root_path}" -name "${pattern}" | while IFS= read -r path_result; do
echo "${path_result}"
done
@ocampor
ocampor / Makefile
Created February 24, 2020 21:04
Makefile to maintain different Python Projects
clean-notebooks:
echo "Cleaning notebooks"
find ./ -name "*.ipynb" | xargs python3 -m nbconvert --ClearOutputPreprocessor.enabled=True --inplace
echo "Removing checkpoints"
find . -type d -iname .ipynb_checkpoints -exec rm -r {} +
@ocampor
ocampor / create-docs.sh
Last active February 26, 2020 11:05
Script to automatically render jupyter notebooks as Markdown
convert_notebook() {
input_path="${1}"
output_path="${2}"
extension="md"
echo "Converting ${input_path} to Markdown"
env ENV=test jupyter nbconvert --ExecutePreprocessor.timeout=180 --stdout --to notebook --execute "${input_path}" |
jupyter nbconvert --stdin --to markdown
file_name=$(basename "${input_path}")
CHROME_SIGNING_KEY_URL="https://dl-ssl.google.com/linux/linux_signing_key.pub"
CHROME_REPOSITORY_URL="https://dl.google.com/linux/chrome/deb/"
CHROME_DRIVER_BIN="chromedriver"
CHROME_DRIVER_ZIP="${CHROME_DRIVER_BIN}_linux64.zip"
CHROME_DRIVER_URL="https://chromedriver.storage.googleapis.com/2.41/${CHROME_DRIVER_ZIP}"
SOURCES_LIST_PATH="/etc/apt/sources.list.d"
install_chrome() {
curl -sS -o - ${CHROME_SIGNING_KEY_URL} | apt-key add
echo "deb [arch=amd64] ${CHROME_REPOSITORY_URL} stable main" >>${SOURCES_LIST_PATH}/google-chrome.list
@ocampor
ocampor / precondition-time-analysis.ipynb
Last active October 2, 2019 16:44
precondition-time-analysis.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
if [ "$TRAVIS_BRANCH" == "master" ]; then
pip install --upgrade twine
python setup.py sdist
python -m twine upload -u ${PYPI_USER} -p ${PYPI_PASSWORD} dist/*
fi
#!/bin/bash
unit_tests() {
pytest
}
package_validation() {
pip install --upgrade twine
python setup.py sdist
validation_output=$(python -m twine check dist/*)
#import <iostream>
#import <vector>
using namespace std;
void print_vector(vector<int> v) {
for(const auto elem: v) {
cout << elem << ' ';
}
from libc.math cimport sin, cos, pi, ceil, floor, pow
from libc.stdlib cimport abort, malloc, free
import numpy as np
cimport numpy as np
cimport cython
from cython.parallel import prange, parallel
cimport openmp
cdef double get_pixel2d(