Skip to content

Instantly share code, notes, and snippets.

View LinuxIsCool's full-sized avatar
💭
Preparing the ship.

Shawn Anderson LinuxIsCool

💭
Preparing the ship.
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@LinuxIsCool
LinuxIsCool / example.py
Created March 16, 2023 22:14 — forked from bhargavkakadiya/example.py
Simple example for Param Panel class interactions
## Run it on jupyter notebook for interactive panel
import param as pm
import panel as pn
class A(pm.Parameterized):
a = pm.Number(2)
class B(pm.Parameterized):
def __init__(self, a:A, **params):
super().__init__(**params)
@LinuxIsCool
LinuxIsCool / README.md
Created November 20, 2022 02:44 — forked from nikoheikkila/README.md
Fish Shell function for sourcing standard .env files

envsource

I've been using Fish shell for years which is great and all, but one thing that has got me frustrated is using it with .env files.

When attempting to run source .env in a project, I usually encounter this problem:

.env (line 2): Unsupported use of '='. In fish, please use 'set KEY value'.
from sourcing file .env
source: Error while reading file '.env'
@LinuxIsCool
LinuxIsCool / Django for Jupyter.md
Created May 12, 2022 16:44 — forked from codingforentrepreneurs/Django for Jupyter.md
Django Setup for use in Jupyter Notebooks

Django for Jupyter

It's true packages exist to make it "easy" to use Django inside of a jupyter notebook. I seem to always run into issues successfully running these packages. I've found the below method useful although I cannot recall how I discovered how this works (aka attribution needed).

Requirements

  • Virtual Environment (virtualenv, venv, pipenv, etc)
  • Django installed & project created (we'll use the project name cfehome)
  • Jupyter installed at least in the virtual environment
# pip install pandas hvplot==0.7.1 holoviews==1.14.3 bokeh panel==0.11.3
# panel serve holoviz_linked_brushing.py --auto --show
import hvplot.pandas
import holoviews as hv
import panel as pn
from bokeh.sampledata.iris import flowers
pn.extension(sizing_mode="stretch_width")
hv.extension("bokeh")
@LinuxIsCool
LinuxIsCool / jupyter_logging.py
Created April 3, 2021 00:42 — forked from wassname/jupyter_logging.py
simple logging for jupyter or python which outputs to stdout (or a console or terminal) and a log file
"""
In jupyter notebook simple logging to console
"""
import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
# Test
logger = logging.getLogger('LOGGER_NAME')
@LinuxIsCool
LinuxIsCool / BokehFigure.py
Created March 15, 2021 02:59 — forked from philippjfr/BokehFigure.py
Defines a BokehFigure element which allows wrapping bokeh Figures in a HoloMap - BSD-3 License
from holoviews import Element, Store
from bokeh.models import Column
from holoviews.plotting.bokeh import ElementPlot
class BokehFigure(Element):
"""Wraps bokeh figure"""
class BokehFigurePlot(ElementPlot):
def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
@LinuxIsCool
LinuxIsCool / chess.py
Created March 12, 2021 16:51 — forked from rsheldiii/chess.py
chess program for python
"""CONVENTIONS:
positions are done row-column from the bottom left and are both numbers. This corresponds to the alpha-number system in traditional chess while being computationally useful. they are specified as tuples
"""
import itertools
WHITE = "white"
BLACK = "black"
@LinuxIsCool
LinuxIsCool / nvim pictures
Last active September 15, 2020 19:50 — forked from fimkap/gist:565d97a6a57a7b9283c8663ae8c9eab1
NeoVim, FZF and termpix setup
# install termpix from https://github.com/mmacedoeu/termpix
# in init.vim, change path to termpix
let g:fzf_layout = { 'down': '~60%' }
let g:fzf_files_options =
\ '--preview "(~/dev/termpix/bin/termpix --width 50 --true-color {} || cat {}) 2> /dev/null "'