Skip to content

Instantly share code, notes, and snippets.

@vinhnx
vinhnx / ollama_dspy.py
Created April 14, 2024 02:06 — forked from jrknox1977/ollama_dspy.py
ollama+DSPy using OpenAI APIs.
# install DSPy: pip install dspy
import dspy
# Ollam is now compatible with OpenAI APIs
#
# To get this to work you must include `model_type='chat'` in the `dspy.OpenAI` call.
# If you do not include this you will get an error.
#
# I have also found that `stop='\n\n'` is required to get the model to stop generating text after the ansewr is complete.
# At least with mistral.
@vinhnx
vinhnx / kitty.conf
Last active April 1, 2024 05:10
my Kitty Terminal config
# vim:fileencoding=utf-8:foldmethod=marker
# Include theme
include ./theme.conf
# ===== Config =====
font_family Menlo
font_size 15.0
@vinhnx
vinhnx / normcore-llm.md
Created March 28, 2024 05:03 — forked from veekaybee/normcore-llm.md
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@vinhnx
vinhnx / UIViewController+ContainerExtensions.swift
Created January 23, 2024 10:51
UIViewController container
import UIKit
extension UIViewController {
func nxv_addChildViewController(_ childVC: UIViewController, containerView: UIView) {
addChild(childVC)
containerView.addSubview(childVC.view)
containerView.translatesAutoresizingMaskIntoConstraints = false
childVC.view.translatesAutoresizingMaskIntoConstraints = false
@vinhnx
vinhnx / clean_code.md
Created June 27, 2022 03:18 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@vinhnx
vinhnx / MyCell.swift
Created May 21, 2022 14:11 — forked from atierian/MyCell.swift
Oversimplified Example of MVVM
class MyCell: UITableViewCell {
let titleLabel = UILabel()
let subtitleLabel = UILabel()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
required init?(coder: NSCoder) { nil }
import Foundation
public protocol NetworkLoggable {
func log<T: CustomStringConvertible>(
label: String,
value: T?,
level: NetworkLogger,
function: StaticString,
line: UInt,
file: String
@vinhnx
vinhnx / packages.json
Created September 19, 2021 02:28
Swift Package Index
{"packages":[{"url":"https:\/\/github.com\/vinhnx\/DictionaryNestedSubscript.git","versions":[{"license":{"url":"https:\/\/github.com\/vinhnx\/DictionaryNestedSubscript\/blob\/master\/LICENSE","name":"MIT"},"defaultToolsVersion":"5.1.0","verifiedCompatibility":[{"swiftVersion":"5.1","platform":{"name":"ios"}},{"swiftVersion":"5.2","platform":{"name":"ios"}},{"swiftVersion":"5.3","platform":{"name":"ios"}},{"swiftVersion":"5.4","platform":{"name":"ios"}},{"swiftVersion":"5.5","platform":{"name":"ios"}},{"swiftVersion":"5.1","platform":{"name":"linux"}},{"swiftVersion":"5.2","platform":{"name":"linux"}},{"swiftVersion":"5.3","platform":{"name":"linux"}},{"swiftVersion":"5.4","platform":{"name":"linux"}},{"swiftVersion":"5.5","platform":{"name":"linux"}},{"swiftVersion":"5.1","platform":{"name":"macos"}},{"swiftVersion":"5.2","platform":{"name":"macos"}},{"swiftVersion":"5.3","platform":{"name":"macos"}},{"swiftVersion":"5.4","platform":{"name":"macos"}},{"swiftVersion":"5.5","platform":{"name":"macos"}},{"swift
@vinhnx
vinhnx / bump_build_version_with_timestamp
Created April 12, 2021 02:45
Xcode bump build version with current timestamp
agvtool new-version -all $(TZ="Asia/Ho_Chi_Minh" date +%Y%m%d.%H%M)