Skip to content

Instantly share code, notes, and snippets.

View renaud's full-sized avatar

Renaud Richardet renaud

  • Eaternity
  • Lausanne, Switzerland
View GitHub Profile
@renaud
renaud / mosaicml_test.py
Last active May 13, 2023 18:17
run LLM locally
!pip install guidance flash_attn einops transformers
# https://medium.com/@marcotcr/exploring-chatgpt-vs-open-source-models-on-slightly-harder-tasks-aa0395c31610
import guidance
find_roots = guidance('''
{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}
@renaud
renaud / print_sub_processes.py
Created November 1, 2022 10:33
Brightway LCA: script to print sub-processes' contributions
#EDB_EXPORTED_DIR = "/Users/ren/dev/eaternity/kale/bw_data/edb_export"
#import os
#os.environ["BRIGHTWAY2_DIR"] = EDB_EXPORTED_DIR
from bw2data import *
import bw2analyzer as bwa
import sys
from bw2calc import LCA
# %%
# unless you would like me to code the Levenshtein algo from hand,
# I will just use a library...
from Levenshtein import distance # !pip install python-Levenshtein
assert distance("ah", "aho") == 1
# %%
# loading dataset, quick inspection
import pandas as pd
# https://opendata.swiss/en/dataset/hundenamen-aus-dem-hundebestand-der-stadt-zurich2/resource/3e48403f-1ca2-434f-8766-cf0a73d7c2a1
@renaud
renaud / farm_en_ner.ipynb
Last active April 15, 2020 20:22
FARM_en_NER.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Regular Expression Cheat Sheet - PCRE

Anchor Description Example Valid match Invalid
^ start of string or line ^foam foam is fun bath foam
$ end of string or line ish$ finish finishing
\b word boundary; position between a word character (\w), and a nonword character (\W) \bis\b This island is beautiful This island isn't beautiful
\B not-word-boundary. \Bland island peninsula

|Char class|Description|Example|Valid match|Invalid|

@renaud
renaud / beerfiller_v2.ino
Created January 2, 2018 22:25
Arduino beerfiller
// dec 2017
// max 2 open at the same time
// oct 2017, works well
// compact for-loop
// same threshold everywhere
// improved debugging output
const int STOP_BUTTON = 12;
const int START_BUTTON = 2;
const int ALL_OFF_LED = 1;
@renaud
renaud / .block
Last active October 24, 2017 09:12
Visualizing PageRank
license: apache-2.0
height: 650
scrolling: no
border: no
@renaud
renaud / acronyms.py
Created August 22, 2016 14:51
Link abbreviations to their full names Based on A Simple Algorithm for Identifying Abbreviations Definitions in Biomedical Text A. Schwartz and M. Hearst Biocomputing, 2003, pp 451-462.
#!/usr/bin/env python
'''Link abbreviations to their full names
Based on
A Simple Algorithm for Identifying Abbreviations Definitions in Biomedical Text
A. Schwartz and M. Hearst
Biocomputing, 2003, pp 451-462.
@renaud
renaud / tornado_rest_server.py
Created February 16, 2016 09:23
Tornado REST server base template
'''
REST endpoint
'''
import os, json
from datetime import date
from tornado import ioloop, web, autoreload
''' serves index.html'''
diff --git a/src/main/resources/fakePom.ftl b/src/main/resources/fakePom.ftl
index 8885fd6..12ca17e 100644
--- a/src/main/resources/fakePom.ftl
+++ b/src/main/resources/fakePom.ftl
@@ -16,6 +16,13 @@
<version>2.6.1-json</version>
<scope>provided</scope>
</dependency>
+ <!-- TODO workaround https://gist.githubusercontent.com/mantognini/2fbeec6fb86aa5290b89/raw/651009b68e72163141f24e982d0bf3bfaddce3ea/stack1 -->
+ <dependency>