Skip to content

Instantly share code, notes, and snippets.

View ionatan-israel's full-sized avatar
🏠
Working from home

Jonatan Rodríguez ionatan-israel

🏠
Working from home
View GitHub Profile
# import required libraries
import pandas as pd
import yfinance as yf
import numpy as np
import math
# get stock prices
df = yf.download('AAPL', start='2020-01-01', threads= False)
# parameter setup
const scraper = require('./scrape.js')
const models = require('./models.js')
const processModels = models => Promise.all(
models.map(model => processLinks(model, model.urls))
).then(
result => console.log(JSON.stringify(result))
)
const processLinks = (model, urls) => Promise.all(
@ionatan-israel
ionatan-israel / middlewares.py
Created December 4, 2018 06:49 — forked from seagatesoft/middlewares.py
An example of RotateUserAgentMiddleware
from random import choice
from scrapy import signals
from scrapy.exceptions import NotConfigured
class RotateUserAgentMiddleware(object):
"""Rotate user-agent for each request."""
def __init__(self, user_agents):
self.enabled = False
self.user_agents = user_agents
@ionatan-israel
ionatan-israel / android_instructions.md
Created November 27, 2018 18:40 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@ionatan-israel
ionatan-israel / flutter.md
Created November 22, 2018 09:52 — forked from matteocrippa/flutter.md
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@ionatan-israel
ionatan-israel / postgres-cheatsheet.md
Created November 20, 2018 20:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -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)
@ionatan-israel
ionatan-israel / kernel_task_cpu_fix
Created September 16, 2018 10:18
Fix kernel_task high CPU usage on OS X
# Boot to recovery mode and disable system integrity protection
csrutil disable
# Reboot to regular mode and purge these motherfuckin plists
sudo rm -f /System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/*.plist
# Reboot to recovery mode and enable system integrity protection
csrutil enable
# Reboot
@ionatan-israel
ionatan-israel / es7-async-await.js
Created September 11, 2017 12:13 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
$api = ms_api();
$member = $api->get_current_member();
// Check if current user is in certain membership:
$membership_id = 100; // hardcode the ID.
$membership_id = $api->get_membership_id( 'premium' ); // fetch by membership name.
if ( $member->has_membership( $membership_id ) ) {
echo "You are member of " . $membership_id;
}
add_action('ms_gateway_cancel_membership', 'm2_delete_user', 999, 1) ;
function m2_delete_user( $sub ) {
wp_delete_user( $sub->user_id );
}