Skip to content

Instantly share code, notes, and snippets.

@startakovsky
startakovsky / preview-fzf.zsh
Last active June 15, 2023 19:08
This is a useful tool created with the help of GPT to get some good preview capabilities searching through files and folders.
## preview fzf
## prerequisites:
## - brew install fzf
## - (brew --prefix)/opt/fzf/install
pf () {
local dir=${1:-"."} # defaults to current directory if no argument is provided
local instructions="=== FILE SELECTION TOOL ===
Multi-select: Press TAB
@startakovsky
startakovsky / conformal_inference_basic_example.ipynb
Last active May 11, 2021 00:34
Conformal Inference Prediction Intervals on Heteroskedastic data using MAD nonconformity scores
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from numpy import vectorize
def mysql_bit_to_bool(values):
"""Return Python [an array of] boolean values."""
mysql_bits = {'\x01': True, '\x00': False}
def wrapper(value):
return mysql_bits[value]
from __future__ import division
from sympy import *
N = symbols('N', integer = True)
a = 45
b = 60
c = 20
d = 85
X = symbols('X')
eqs = (
X - 2*N*(abs(a*d-b*c)-N)**2/((a+c)*(b+d)*N**2)
@startakovsky
startakovsky / gist:c47469c588902d0bf814
Created June 25, 2015 22:48
one strategy for dealing with sql queries.... it's imperfect but that's what you wanted i think.
class PostGres(object):
connection = None
def __init__(self, connection, debug_on=True):
self.connection = connection
self.autocommit = True
self.debug_on = debug_on
def get_table_count(self, table):
@startakovsky
startakovsky / gist:296d20fff02662abd441
Created June 24, 2015 04:57
richie's rolling average question
{
"metadata": {
"name": "",
"signature": "sha256:d2c68b4373fca3af6f3e771c8cdbccc2c8dd3c0fd7e82dd401199d6e0fa16c86"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@startakovsky
startakovsky / list_to_table.py
Created December 7, 2012 18:35
Make an HTML table from a List
html(tab_list([[i,i.get_sign(),d[i],d[i].get_sign()] for i in d], headers = ['element',sign,'image',sign]))
def tab_list(y, headers = None):
'''
Converts a list into an html table with borders.
'''
s = '<table border = 1>'
if headers:
for q in headers:
s = s + '<th>' + str(q) + '</th>'