Compile ollama in Ubuntu 22.04:
# Install and activate oneapi
sudo apt install intel-basekit
source /opt/intel/oneapi/setvars.sh
# You may need to install other build dependencies ...
# sudo apt install apt-utils
""" | |
ReAct agent example | |
Adapted from: https://langchain-ai.github.io/langgraph/how-tos/tool-calling/ | |
""" | |
from langchain_core.tools import tool | |
from langgraph.prebuilt import ToolNode | |
from langgraph.graph import StateGraph, MessagesState | |
from langgraph.prebuilt import ToolNode | |
from langgraph.graph import StateGraph, MessagesState, START, END |
Compile ollama in Ubuntu 22.04:
# Install and activate oneapi
sudo apt install intel-basekit
source /opt/intel/oneapi/setvars.sh
# You may need to install other build dependencies ...
# sudo apt install apt-utils
""" | |
Example adapted from https://github.com/aamini/introtodeeplearning lab2 part2 | |
© MIT Introduction to Deep Learning | |
http://introtodeeplearning.com | |
""" | |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
import functools | |
import numpy as np |
""" | |
Simple Gantt chart implementation | |
""" | |
from datetime import datetime as dt | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from matplotlib.dates import date2num | |
import matplotlib.dates as mdates | |
import numpy |
#!/bin/bash | |
# generate mp4 animation from still images with ffmpeg. | |
if [ $# != 2 ]; then | |
echo "Usage: $(basename "$0") \"image/file/pattern_*.png\" output.mp4" | |
exit -1 | |
fi | |
pattern=$1 | |
outputfile=$2 |
#!/bin/bash | |
# loop through days of month given the first day | |
startdate="2019-06-01" | |
enddate=$(date -d "$startdate + 1 month" +"%Y-%m-%d") | |
ndays=$(( ($(date -d "$enddate" +%s) - $(date -d "$startdate" +%s) )/(60*60*24) )) | |
for i in $(seq 0 $(($ndays - 1)) ); do |
""" | |
Python argparse example demonstrating the most common usage options. | |
""" | |
import argparse | |
parser = argparse.ArgumentParser( | |
description='Description of the routine', | |
# includes default values in help entries | |
formatter_class=argparse.ArgumentDefaultsHelpFormatter, | |
) |
#!/bin/bash | |
# Install SLIM on rigilk cluster | |
source ~/bin/activate_gcc6.4 | |
source ~/bin/activate_cmake-3.11.4 | |
source ~/bin/activate_openmpi.sh | |
export BASEDIR=/home/karnat/sources/slim/install-script | |
mkdir -p $BASEDIR |
from thetis import * | |
""" | |
Computes a "strong" vertical integral of a field with pyop2 | |
by integrating along the vertical 1D edges of the prism. | |
""" | |
def strong_integral_2d(source, output_2d, z_coords): | |
"""Computes strong integral of a P1DGxP1DG field onto P1DG 2D field""" |