Skip to content

Instantly share code, notes, and snippets.

@skoudoro
skoudoro / langchain_qa_chatgpt_bot.py
Created August 16, 2023 22:18 — forked from czue/langchain_qa_chatgpt_bot.py
sample code for chatgpt / gpt4 langchain Q&A
# see https://www.youtube.com/watch?v=CsFpVdgEXCU for details of what this does
from typing import List
from langchain import ConversationChain
from langchain.chat_models import ChatOpenAI
from langchain.indexes.vectorstore import VectorStoreIndexWrapper
from langchain.memory import ConversationBufferMemory
from langchain.prompts import (
ChatPromptTemplate,
@skoudoro
skoudoro / saas_metric.py
Last active January 11, 2023 21:59
saas metrics in python
"""This need some work but this is a starter."""
# Import Stripe Python Library
import stripe
# Connect to stripe
stripe.api_key = {your_api_key}
# Get saas monthly revenue
monthly_revenue = stripe.Charge.list(
from libc.stdint cimport uint32_t, uint64_t, int32_t, uint8_t, int64_t, uint16_t
cdef extern from "vulkan.h":
ctypedef uint32_t VkBool32
ctypedef uint64_t VkDeviceAddress
ctypedef uint64_t VkDeviceSize
@skoudoro
skoudoro / Motion_correction.py
Created July 20, 2021 19:07
Motion correction demo
"""
==========================================
Motion correction of DWI data
==========================================
"""
import numpy as np
from dipy.viz import regtools
from dipy.data import fetch_stanford_hardi, read_stanford_hardi
from dipy.data.fetcher import fetch_syn_data, read_syn_data
@skoudoro
skoudoro / sh_demo.py
Created June 18, 2020 04:44
sh demo for glsl
import numpy as np
from dipy.sims.voxel import multi_tensor_odf
from dipy.data import get_sphere
from dipy.reconst.shm import sf_to_sh
mevals = np.array([[0.0015, 0.0003, 0.0003],
[0.0015, 0.0003, 0.0003]])
angles = [(0, 0), (60, 0)]
fractions = [50, 50]
@skoudoro
skoudoro / pep20_by_example.py
Created May 31, 2020 12:09 — forked from evandrix/pep20_by_example.py
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
@skoudoro
skoudoro / branch-fu.md
Created May 26, 2020 19:42 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@skoudoro
skoudoro / markdown_doc
Created January 10, 2020 21:24 — forked from jiffyclub/markdown_doc
This script turns Markdown into HTML using the Python markdown library and wraps the result in a complete HTML document with default Bootstrap styling so that it's immediately printable. Requires the python libraries jinja2, markdown, and mdx_smartypants.
#!/usr/bin/env python
import argparse
import sys
import jinja2
import markdown
TEMPLATE = """<!DOCTYPE html>
<html>
@skoudoro
skoudoro / main.qml
Last active December 18, 2019 20:16 — forked from rostikL/main.qml
QQuickFramebufferObject
import QtQuick 2.3
import Renderer 1.0
Item {
width: 500
height: 600
FBORenderer{
id: fboRenderItem
anchors.fill: parent
@skoudoro
skoudoro / mppca.py
Last active October 17, 2019 19:39
test mppca with dipy
from dipy.reconst.shore import ShoreModel
from dipy.reconst.forecast import ForecastModel
from dipy.data import (fetch_cenir_multib, read_cenir_multib, get_sphere,
fetch_isbi2013_2shell, read_isbi2013_2shell,
fetch_cfin_multib, read_cfin_dwi)
import time
import multiprocessing
import numpy as np
import math