This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.express as px | |
fig = px.line(y=[1,2,3,2,1]) | |
fig.data[0].update(mode='lines+markers') | |
fig.show() | |
# or fig.update_traces(mode='lines+markers') for all traces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.graph_objects as go | |
import plotly.io as io | |
fig = go.Figure() | |
fig.update_layout(legend=dict(orientation = "h", | |
xanchor = "center", | |
x = 0.5), | |
margin=dict(l=20, r=20, t=20, b=20)) | |
templated_fig = pio.to_templated(fig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.io as pio | |
# see docs at https://plot.ly/python/renderers/ | |
# render and display plots as png images | |
pio.renderers.default = "png" | |
# override the renderer for a specific figure | |
fig.show(renderer="notebook_connected") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: See https://superuser.com/a/1325836 | |
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search /f /v BingSearchEnabled /t REG_DWORD /d 0 | |
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search /f /v AllowSearchToUseLocation /t REG_DWORD /d 0 | |
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search /f /v CortanaConsent /t REG_DWORD /d 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to MLaovie, https://stackoverflow.com/a/50766967/3279307 | |
library(plotly) | |
library(crosstalk) # update HTML widgets over a common dataset | |
library(DT) | |
sd <- SharedData$new(iris) # put your dataframe here | |
a <- plot_ly(sd, x = ~Sepal.Width, y = ~Petal.Width) %>% | |
add_markers(alpha = 0.5) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: jupyterify in_file.py out_file.py | |
import re | |
import sys | |
try: | |
in_path = sys.argv[1] | |
out_path = sys.argv[2] | |
except: | |
print('Please pass input and output path!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# must run from the shell: | |
# Policies are described here: | |
# https://docs.microsoft.com/en-gb/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-6 | |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import secrets | |
import string | |
alphabet = string.ascii_letters + string.digits | |
key = ''.join(secrets.choice(alphabet) for i in range(40)) | |
print(key) | |
# source: https://www.geeksforgeeks.org/secrets-python-module-generate-secure-random-numbers/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prop(obj): | |
return sorted( obj._prop_map_get_.keys()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__loc__ = locals().copy() | |
def __list_env__(loc): | |
import sys | |
import json | |
from numpy import ndarray | |
from types import ModuleType | |
def serialize(x): | |
if isinstance(x, ndarray): | |
return str(x.tolist()) | |
else: |