As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.
The problems and solutions described in the examples below have led to the development of sciluigi,
import React, { useEffect } from "react"; | |
import PropTypes from "prop-types"; | |
import { Prompt } from "react-router-dom"; | |
// Prompt the user onbeforeunload or when navigating away by clicking a link | |
export default function PromptOnUnload({ when, message }) { | |
const enabled = when; | |
useEffect(() => { | |
if (!enabled) return; | |
const handleBeforeUnload = (event) => { |
import React from 'react' | |
//configuration file that has the values stored for users | |
import config from './config' | |
class SampleDashboard extends React.Component { | |
render() { | |
//suppose user is received from props | |
const { user } = this.props | |
return ( |
import sys | |
import pytest | |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import sessionmaker | |
from alembic.command import upgrade as alembic_upgrade | |
from alembic.config import Config as AlembicConfig | |
from wsgi import create_app | |
from config import config |
As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.
The problems and solutions described in the examples below have led to the development of sciluigi,
declare global { | |
enum ChooseFileSystemEntriesType { | |
'open-file', | |
'save-file', | |
'open-directory' | |
} | |
interface ChooseFileSystemEntriesOptionsAccepts { | |
description?: string; | |
mimeTypes?: string; |
import React, { useEffect } from 'react'; | |
/** | |
* useIsMounted hook can be used to check if a component is still mounted. | |
* Then, one can prevent a state update on an unmounted component, and therefore avoid memory leaks | |
*/ | |
function useIsMounted() { | |
const isMounted = React.useRef(true); | |
useEffect(() => { |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
edit /etc/hosts add my.
#!/bin/bash | |
function calc_percentage () { | |
mem="$1" | |
total="$2" | |
if [[ $mem -gt 0 ]]; then | |
return $((mem * 100 / total)) | |
else | |
return 0 | |
fi |
import requests | |
import json | |
def make_query(url, q, alg, field, shard_size=1000, size=25): | |
"""Get keywords relating to the input query, directly from Elasticsearch | |
Args: | |
url (str): The Elasticsearch endpoint you want to query | |
q (str): The query you want to retrieve keywords for | |
alg (str): An algorithm from https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html#_parameters |