Skip to content

Instantly share code, notes, and snippets.

View steren's full-sized avatar
🏃‍♀️

Steren steren

🏃‍♀️
View GitHub Profile
@steren
steren / llamafile.Dockerfile
Last active April 29, 2024 05:32
llamafile container image
FROM debian:latest
RUN apt-get update && apt-get install -y wget
# Update this to the URL pointing at the llamafile you want to run.
# Find other models at https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#other-example-llamafiles
ENV LLAMAFILE_DOWNLOAD_URL="https://huggingface.co/jartine/Mistral-7B-Instruct-v0.2-llamafile/resolve/main/mistral-7b-instruct-v0.2.Q4_0.llamafile?download=true"
# Download the llamafile and make it executable
RUN wget $LLAMAFILE_DOWNLOAD_URL -O ./model.llamafile && chmod +x ./model.llamafile
We can't make this file beautiful and searchable because it's too large.
pattern,cnt
^,1657
-$,376
--,355
root.*/file.*\n,348
(?m)^hello world,338
\s+,296
\s*,278
^[a-z],275
[cg]pu,245
@steren
steren / nginx.conf
Created November 3, 2022 23:59
nginx.conf with gzip enabled
server {
listen 8080;
server_name _;
gzip on;
location / {
proxy_pass http://127.0.0.1:8888;
}
}
@steren
steren / function.js
Created August 19, 2022 04:52
Firestore in Cloud Functions
const {Firestore} = require('@google-cloud/firestore');
const firestore = new Firestore();
exports.helloWorld = async (req, res) => {
const document = firestore.doc('users/steren');
const doc = await document.get();
console.log('Read the document');
res.status(200).send('Hey');
};
@steren
steren / enable-fb-hosting-cloud-run.sh
Last active March 26, 2022 19:14
Set up Firebase Hosting in front of a Cloud Run service
#!/bin/bash
# Set up Firebase Hosting in front of a Cloud Run service, without using the firebase CLI
# The following commands must be installed:
# - gcloud
# - curl
# - jq
# Update these variables
PROJECT_ID="enable-fb-hosting" # Make sure you have enabled Firebase on this Google Cloud project
@steren
steren / gist:1538982
Created December 30, 2011 09:35
Git: compare a local branch with upstream repository
git fetch upstream && git diff remotes/upstream/master master > changes.diff
@steren
steren / curl.sh
Last active April 16, 2021 23:17
Query GCP metadata server
$ curl -H "Metadata-Flavor:Google" http://metadata.google.internal/computeMetadata/v1/project/project-id
@steren
steren / Application.java
Created November 3, 2010 10:22
Upload and store image with Play! Framework
public class Application extends Controller {
public static void index() {
render();
}
public static void uploadPicture(Picture picture) {
picture.save();
index();
}
@steren
steren / regexp-github.sql
Last active July 13, 2020 17:49
Extract constant Go regular expressions from GitHub
# Extracts constant Go regular expressions from GitHub
# using BigQuery GitHub public dataset.
# To run on the entire GitHub corpus,
# remove the `sample_` prefix from the table names.
# Warning: This query processes ~2.2 TB of data, which is above BigQuery free quota.
SELECT
REGEXP_EXTRACT(pattern, r'^[\"\`](.*)[\"\`]$') as pattern,
COUNT(*) AS cnt,
FROM (
SELECT
@steren
steren / chunked.go
Created July 7, 2020 03:52
Transfer-Encoding: chunked
package main
import (
//"bytes"
//"io/ioutil"
"fmt"
"io"
"log"
"net/http"
"os"