Skip to content

Instantly share code, notes, and snippets.

View lvidarte's full-sized avatar

Leo Vidarte lvidarte

View GitHub Profile
@lvidarte
lvidarte / gist:1aeb2b58d874d19eed5e6fea6f0e7ed2
Created March 27, 2019 20:03
Build image inside minikube and then use it from there
# 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 July 28, 2018 23:55
Test Jupyter Notecook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 November 19, 2017 10:34 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

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 November 6, 2017 13:45 — forked from marianposaceanu/linux_fun.md
How to have some fun using the terminal.

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!
package main
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/hex"
"encoding/json"
"errors"
"io"
@lvidarte
lvidarte / gist:14864e94c857fb3bc0eca805d977ec8d
Created September 3, 2017 12:10 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#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 June 27, 2017 20:42
Node 8 - Promises recursion
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 June 27, 2017 20:39
Node 8 - Cluster Express server
var cluster = require('cluster');
const PORT = 3000;
if (cluster.isMaster) {
const numWorkers = require('os').cpus().length;
console.log(`Master cluster setting up ${numWorkers} workers...`);
@lvidarte
lvidarte / app.py
Created June 13, 2017 20:22
Generic API
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] = []