Skip to content

Instantly share code, notes, and snippets.

View joefutrelle's full-sized avatar

Joe Futrelle joefutrelle

  • Falmouth, MA
View GitHub Profile
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active August 15, 2024 07:10
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@joefutrelle
joefutrelle / MATLAB_datetimes.py
Created April 26, 2022 16:15
Convert MATLAB datenums to/from Python datetimes
from datetime import datetime, timedelta
# util for converting MATLAB datenum to Python datetime
# as described in http://stackoverflow.com/questions/13965740/converting-matlabs-datenum-format-to-python
def datenum2datetime(matlab_datenum):
dt = datetime.fromordinal(int(matlab_datenum)) + timedelta(days=matlab_datenum%1) - timedelta(days = 366)
return dt
# util for converting datetime to MATLAB datenum
# as described in http://stackoverflow.com/questions/8776414/python-datetime-to-matlab-datenum
@joefutrelle
joefutrelle / tpj.pl
Last active September 18, 2023 16:34
Obfuscated Perl contest winner from 1997 (note: no longer works)
package S2z8N3;{
$zyp=S2z8N3;use Socket;
(S2z8N3+w1HC$zyp)&
open SZzBN3,"<$0"
;while(<SZzBN3>){/\s\((.*p\))&/
&&(@S2zBN3=unpack$age,$1)}foreach
$zyp(@S2zBN3){
while($S2z8M3++!=$zyp-
30){$_=<SZz8N3>}/^(.)/|print $1
;$S2z8M3=0}s/.*//|print}sub w1HC{$age=c17
@joefutrelle
joefutrelle / install-docker.sh
Last active February 1, 2019 13:35
Install Docker in Debian
# current as of 2018-12-10
# install docker-ce: https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-ce-1
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt-get update
@joefutrelle
joefutrelle / parse_btl_file.ipynb
Last active February 5, 2024 11:55
Parse Seabird CTD .btl file
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / aaa_nut_reps2netcdf.py
Last active May 1, 2018 17:54
create CF compliant NetCDF files from MVCO nutrient data
import os
from scipy.io import loadmat
import pandas as pd
from pocean.dsg.timeseriesProfile.om import OrthogonalMultidimensionalTimeseriesProfile as OMTP
MAT_FILE = '/vagrant/nut_data_reps.mat'
OUT_DIR = './output'
mat = loadmat(MAT_FILE, squeeze_me=True)
@joefutrelle
joefutrelle / dir_rate.py
Created August 9, 2017 13:09
computes rate of mods to files in a directory and reports in files/hr
from __future__ import print_function
import os
import sys
DIR=sys.argv[1]
times = []
for fn in os.listdir(DIR):
path = os.path.join(DIR, fn)
@jakebrinkmann
jakebrinkmann / connect_psycopg2_to_pandas.py
Created July 3, 2017 14:19
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@joefutrelle
joefutrelle / basic multiprocessing.ipynb
Created August 10, 2016 15:23
Introduction to multiprocessing in iPython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / Decision tree cubism.ipynb
Created May 3, 2016 13:58
Cubism using decision tree
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.