Skip to content

Instantly share code, notes, and snippets.

View germayneng's full-sized avatar

Germayne germayneng

View GitHub Profile
@ryo-ARAKI
ryo-ARAKI / starship.toml
Last active July 24, 2024 09:07
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"
[[battery.display]]
threshold = 30
style = "bold red"
@raphaelvallat
raphaelvallat / distcorr.py
Last active December 12, 2023 06:50 — forked from wladston/distcorr.py
Distance correlation with permutation test
import numpy as np
import multiprocessing
from joblib import Parallel, delayed
from scipy.spatial.distance import pdist, squareform
def _dcorr(y, n2, A, dcov2_xx):
"""Helper function for distance correlation bootstrapping.
"""
# Pairwise Euclidean distances
b = squareform(pdist(y, metric='euclidean'))
@blackcater
blackcater / diagrams.md
Created July 6, 2018 16:45
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.

@gschivley
gschivley / altair_app.py
Created May 13, 2018 18:32
Altair plot in Plotly Dash
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
import sqlalchemy
import altair as alt
import io
from vega_datasets import data
@bshishov
bshishov / forecasting_metrics.py
Last active July 19, 2024 18:17
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
@Den1al
Den1al / aiohttp-example.py
Last active June 22, 2023 12:53
concurrent http requests with aiohttp
# author: @Daniel_Abeles
# date: 18/12/2017
import asyncio
from aiohttp import ClientSession
from timeit import default_timer
import async_timeout
async def fetch_all(urls: list):
@gleicon
gleicon / list_objects_google_storage_boto3.py
Last active October 11, 2023 14:27
How to use boto3 with google cloud storage and python to emulate s3 access.
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
ACCESS_KEY = "xx"
SECRET_KEY = "yy"
boto3.set_stream_logger('')
@kent119
kent119 / nginx_reverse_for_notebook
Last active July 18, 2020 00:14
Config Nginx as a reverse proxy for Jupyter notebook on VPS
# /etc/nginx/sites-enabled/some.domain
# Change the server name {some.domain}
# Change the {host.of.notebook} and {port} in the following locations
server {
listen 80;
# Change the server name {some.domain}
server_name some.domain;
location / {
# Change the {host.of.notebook} and {port}
proxy_pass http://host.of.notebook:port;
@ragulpr
ragulpr / py
Last active December 7, 2020 10:24
Keras masking example
import keras
from keras.layers import *
from keras.models import Model
import theano as T
import tensorflow as tf
print('theano ver.',T.__version__)
print('tensorflow ver.',tf.__version__)
print('keras ver.',keras.__version__)
np.set_printoptions(precision=4)
np.random.seed(1)
@deehzee
deehzee / autoreload.md
Last active December 1, 2021 19:48
Auto reload of modules in jupyter notebook

Module autoreload

To auto-reload modules in jupyter notebook (so that changes in files *.py doesn't require manual reloading):

# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2