Skip to content

Instantly share code, notes, and snippets.

View BSCowboy's full-sized avatar

Bryan Smith BSCowboy

  • DoD
  • Austin, TX
View GitHub Profile
@ines
ines / diff_strings.py
Created August 1, 2019 12:19
Print colored visual diff in Python
import difflib
import wasabi
def diff_strings(a, b):
output = []
matcher = difflib.SequenceMatcher(None, a, b)
for opcode, a0, a1, b0, b1 in matcher.get_opcodes():
if opcode == "equal":
output.append(a[a0:a1])
elif opcode == "insert":
@fperez
fperez / README.md
Last active July 1, 2021 04:43
Polyglot Data Science with IPython

Polyglot Data Science with IPython & friends

Author: Fernando Pérez.

A demonstration of how to use Python, Julia, Fortran and R cooperatively to analyze data, in the same process.

This is supported by the IPython kernel and a few extensions that take advantage of IPython's magic system to provide low-level integration between Python and other languages.

See the companion notebook for data preparation and setup.

@alchemyst
alchemyst / spreadsheet.py
Created December 18, 2017 13:41
Spreadsheet in 100 lines of Python
#!/usr/bin/env python
import tkinter as tk
import math
import re
from collections import ChainMap
Nrows = 5
Ncols = 5
@AustinRochford
AustinRochford / pymc3-fosscon2017.ipynb
Last active November 10, 2023 03:18
Open Source Bayesian Inference in Python with PyMC3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@willingc
willingc / tutorials_by_category.ipynb
Created March 31, 2017 13:23
Get a list of Adafruit tutorials for a particular category
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@debasishg
debasishg / gist:9fe9037d9a94595b35e96529fcdd4e9a
Last active January 9, 2018 02:24
Sample run of NN based solution to anomaly detection
Python 3.6.0 |Anaconda 4.3.0 (x86_64)| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> import numpy
>>> data_dir = "/Users/debasishghosh/temp/ingest-intrusion-data/ingest-intrusiondata-tmp"
>>> train_data = data_dir + "/new_train_data.csv"
>>> train_labels = data_dir + "/train_labels.csv"
>>> test_data = data_dir + "/new_test_data.csv"
>>> test_labels = data_dir + "/test_labels.csv"
@leonawicz
leonawicz / app.R
Last active March 14, 2021 06:27
Use custom local image files as icons in a Shiny Dashboard value box
#
# This Shiny web application demonstrates the use of custom image files
# in place of icons for value boxes in Shiny Dashboard by overriding two
# functions:
#
# 'icon' from the shiny package and 'valueBox' from the shinydashboard package.
#
# Each function adds minimal, specific additional handling of image files.
# Note: A custom css file must also be included so that value boxes can
# display the icons. For that reason, do not expect images in place of icons to
@timvieira
timvieira / counterfactual-demo.ipynb
Last active May 12, 2022 05:25
Counterfactual reasoning demo. Accompanies blog post "Counterfactual reasoning and learning from logged data" http://timvieira.github.io/blog/post/2016/12/19/counterfactual-reasoning-and-learning-from-logged-data/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.