Skip to content

Instantly share code, notes, and snippets.

Avatar

Leo Vidarte lvidarte

View GitHub Profile
@lvidarte
lvidarte / gist:1aeb2b58d874d19eed5e6fea6f0e7ed2
Created Mar 27, 2019
Build image inside minikube and then use it from there
View gist:1aeb2b58d874d19eed5e6fea6f0e7ed2
# Start minikube
minikube start
# Set docker env
eval $(minikube docker-env)
# Build image
docker build -t foo:0.0.1 .
# Run in minikube
@lvidarte
lvidarte / test.ipynb
Created Jul 28, 2018
Test Jupyter Notecook
View test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View tirar
from selenium import webdriver
browser = webdriver.Chrome()
browser.get("https://www.imaginelearning.com")
e = browser.get_element_by<tab>
e = browser.find_element_by_css_selector("div.banner-content > div.content > div:nth-child(3)")
e.text
@lvidarte
lvidarte / postgres-cheatsheet.md
Created Nov 19, 2017 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@lvidarte
lvidarte / linux_fun.md
Last active Nov 6, 2017 — forked from marianposaceanu/linux_fun.md
How to have some fun using the terminal.
View linux_fun.md

Linux fun-o-matic

How to have some fun using the terminal.

  1. Install cowsay [0] via : sudo apt-get install cowsay
  2. Install fortune [1] via : sudo apt-get install fortune
  3. Make sure you have Ruby installed via : ruby -v
  4. Install the lolcat [2] via : gem gem install lolcat
  5. Profit!
View shellinabox-proxy.go
package main
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/hex"
"encoding/json"
"errors"
"io"
View gist:14864e94c857fb3bc0eca805d977ec8d
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@lvidarte
lvidarte / promises.js
Created Jun 27, 2017
Node 8 - Promises recursion
View promises.js
var myPromise = (i) => {
let time = Math.floor(Math.random() * 5000) + 5000;
console.log(`new promise ${i} for ${time}ms`)
return new Promise((resolve, reject) => {
let random = Math.floor(Math.random() * 2);
@lvidarte
lvidarte / express.js
Created Jun 27, 2017
Node 8 - Cluster Express server
View express.js
var cluster = require('cluster');
const PORT = 3000;
if (cluster.isMaster) {
const numWorkers = require('os').cpus().length;
console.log(`Master cluster setting up ${numWorkers} workers...`);
View app.py
from flask import Flask, request, jsonify
app = Flask(__name__)
data = {}
@app.route("/<name>", methods=['GET', 'POST'])
def endpoint(name):
if request.method == 'POST':
if name not in data:
data[name] = []