Skip to content

Instantly share code, notes, and snippets.

View javierluraschi's full-sized avatar
👨‍💻
Coding @hal9ai

Javier Arturo Porras Luraschi javierluraschi

👨‍💻
Coding @hal9ai
View GitHub Profile
@javierluraschi
javierluraschi / posenet-elon.html
Created July 15, 2021 17:06
PoseNet with tensorflow.js and Elon image
<html>
<body>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/posenet"></script>
<img id='pose' src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/AAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAAABzAAAAEBkZXNjAAAAAAAAAANjMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0ZXh0AAAAAEZCAABYWVogAAAAAAAA9tYAAQAAAADTLVhZWiAAAAAAAAADFgAAAzMAAAKkWFlaIAAAAAAAAG+iAAA49QAAA5BYWVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPY3VydgAAAAAAAAAaAAAAywHJA2MFkghrC/YQPxVRGzQh8SmQMhg7kkYFUXdd7WtwegWJsZp8rGm/fdPD6TD////+ACVSZXNpemVkIG9uIGh0dHBzOi8vZXpnaWYuY29tL3Jlc2l6Zf
@javierluraschi
javierluraschi / index.html
Last active December 7, 2020 19:31
Create ETH Wallet
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js"></script>
<script>
const create = () => {
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io'));
let account = web3.eth.accounts.create(web3.utils.randomHex(32));
document.getElementById('address').innerText = account.address;
document.getElementById('key').innerText = account.privateKey;
@javierluraschi
javierluraschi / distributed-dl-spark.md
Created May 5, 2020 18:54
Script to perform distributed deep learning in Spark from R
library(sparklyr)
sc <- spark_connect(master = "yarn", spark_home = "/usr/lib/spark/", config = list(spark.dynamicAllocation.enabled = FALSE, `sparklyr.shell.executor-cores` = 8, `sparklyr.shell.num-executors` = 3, sparklyr.apply.env.WORKON_HOME = "/tmp/.virtualenvs"))

sdf_len(sc, 3, repartition = 3) %>%
  spark_apply(function(df, barrier) {
    tryCatch({
      library(tensorflow)
      library(keras)
      
@javierluraschi
javierluraschi / covid19-daily-cases-world-use.md
Last active April 22, 2020 15:32
COVID-19:: Daily Confirmed Cases -- Worldwide and USA

COVID-19: Daily Confirmed Cases

Using data from RamiKrispin/coronavirus, first plot worldwide new cases for countries with more than a thousand cases:


title: "R Notebook" output: html_notebook

@javierluraschi
javierluraschi / recording-videos-with-obs.md
Created March 16, 2020 16:20
Recording videos with OBS

Why OBS? It's free and Twitch streamers have proven it is quite configurable and reliable.

Configuration

  1. Download OBS (Mac, Linux, Mac) from: https://obsproject.com/download
  2. Install and Launch OBS.
  3. Create an Scene
  4. Add Display Capture and Audio Capture
  5. Open the Settings window and select Output, then Recording, select mp4
  6. Still under Settings, Hotkeys tab, I recommend adding a hot key to start and stop recording.
  7. Close Settings window.
@javierluraschi
javierluraschi / amazon-emr-tidymodels-tune.md
Last active March 7, 2020 20:36
Amazon EMR with tidymodels and tune

Create EMR cluster with support for R.

Fix Development Tools to fix gower package installation,

sudo yum remove gcc72-c++.x86_64 libgcc72.x86_64
sudo yum groupinstall 'Development Tools'
@javierluraschi
javierluraschi / FakeHTTPServer.py
Created January 24, 2020 00:13
Simple Proxy Variations
import SimpleHTTPServer
import BaseHTTPServer
def main():
request_handler = SimpleHTTPServer.SimpleHTTPRequestHandler
request_handler.server_version = "Jetty(8.y.z-SNAPSHOT)"
request_handler.sys_version = ""
BaseHTTPServer.test(HandlerClass = request_handler, ServerClass = BaseHTTPServer.HTTPServer)
if __name__ == "__main__":
@javierluraschi
javierluraschi / pytorch-example-visual-studio.cpp
Created January 16, 2020 23:50
PyTorch 1.3.0 example with Visual Studio
#ifdef _MSC_VER
#pragma warning( disable : 4146 )
#endif
#include <iostream>
#include <torch/torch.h>
struct Net : torch::nn::Module {
Net(int64_t N, int64_t M) {
W = register_parameter("W", torch::randn({ N, M }));
@javierluraschi
javierluraschi / spark-delta-lake-mlflow.md
Last active March 27, 2021 19:13
Using Spark, Delta Lake and MLflow
title output
Using Spark, Delta Lake and MLflow
html_notebook

First we define helper functions,

delta_version <- function(sc, path) {
  invoke_static(sc, "io.delta.tables.DeltaTable", "forPath", spark_session(sc), path) %>%
@javierluraschi
javierluraschi / torch-build-windows-rtools.md
Last active January 13, 2020 21:19
Building Torch in Windows with RTools 4.0