Skip to content

Instantly share code, notes, and snippets.

View jaigouk's full-sized avatar

Jaigouk Kim jaigouk

View GitHub Profile
@ivanfioravanti
ivanfioravanti / gist:bcacc48ef68b02e9b7a4034161824287
Created January 25, 2024 00:01
Fine tuning dataset generation wiht Ollama python library
import json
import os
import ollama
def query_ollama(prompt, model='openhermes:7b-mistral-v2.5-q6_K', context=''):
response = ollama.generate(
model=model,
prompt=context + prompt)
return response['response'].strip()
@rylev
rylev / rust-in-large-organizations-notes.md
Last active February 2, 2023 10:08
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@alexellis
alexellis / README.md
Last active May 23, 2019 07:24
OpenFaaS Cloud Community Cluster instructions
@alexellis
alexellis / README.md
Last active April 8, 2022 20:16
OpenFaaS functions on knative

Portability with knative

Three functions from the OpenFaaS store have been packaged as "knative serving" definitions. No change to the container or code is needed.

  • Inception - identify the content of images with machine-learning - is it a bird, a plane or what?
  • Colorise - turn any black and white image into colour
  • NodeInfo - give system info, pass "verbose" as the body for network adapters etc.
@ziazek
ziazek / deploy_phoenix
Created June 10, 2017 05:32
nginx configuration
upstream deploy_phoenix {
server 127.0.0.1:8888;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# REDIRECT HTTP www.example.com to HTTPS example.com
@karpathy
karpathy / nes.py
Last active October 23, 2023 17:50
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize
@narrowtux
narrowtux / model.ex
Last active February 16, 2023 08:39
Recursive models with ecto
defmodule Model do
schema "models" do
field :foo, :string
has_many :children, Model, foreign_key: :parent_id
belongs_to :parent, Model, foreign_key: :parent_id
end
@doc """
Recursively loads parents into the given struct until it hits nil
"""
@eightyknots
eightyknots / avregex.md
Last active March 20, 2024 20:05
AvReg: Aviation regex match toolkit

AvReg: The Aviation RegEx Match Toolkit

General Tips

  • The PCRE flavour of RegEx is used here.
  • Append the i modifier to the end of the regex to make any pattern case-insensitive.

Aircraft

| Purpose | Description | RegEx | Example |

@janko
janko / 01-requirements.md
Last active March 6, 2023 11:15
ActiveRecord vs Sequel (require time)
$ brew install cloc
$ bundle install
#Let's take a look at the welcome method of the User model.
#This method is doing way too many things,
#you really need to split it up into separate private methods.
#Create the following private methods:
#send_welcome_email, enable_welcome_tour, enable_welcome_promotion.
#Then move the code from the welcome method into each one.
#Make sure to still call each method from within the welcome method.
class User < ActiveRecord::Base