Disclaimer: I have no idea what I'm doing. This gist is a scratchpad for me to hopefully one make sense of things. Expect nonsensical notes jotted on this page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import base64 | |
import json | |
import os | |
import pyaudio | |
from websockets.asyncio.client import connect | |
class SimpleGeminiVoice: | |
def __init__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// LiquidCircles | |
// | |
// Created by Paul Stamatiou on 10/10/22. | |
// | |
import SwiftUI | |
struct ContentView: View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: SwiftUI-Lab (swiftui-lab.com) | |
// Description: Implementation of the showSizes() debugging modifier | |
// blog article: https://swiftui-lab.com/layout-protocol-part-2 | |
import SwiftUI | |
struct MeasureExample: View { | |
var body: some View { | |
VStack { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CoreMedia | |
extension UIView { | |
func toCMSampleBuffer() -> CMSampleBuffer? { | |
let scale: CGFloat = UIScreen.main.scale | |
let size: CGSize = .init(width: bounds.width * scale, height: bounds.height * scale) | |
guard let pixelBuffer = makeCVPicelBuffer(scale: scale, size: size) else { return nil } | |
defer { | |
CVPixelBufferUnlockBaseAddress(pixelBuffer, CVPixelBufferLockFlags(rawValue: 0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Foundation | |
// NOTE: This playground shows how to use Swift's AttributedString with Markdown. | |
// | |
// This code was used to display Markdown content in the Tot iOS Widget <https://tot.rocks> | |
// MARK: - Helpful Links | |
// NOTE: The following links helped me figure this stuff out. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
Task { | |
// 1️⃣❓ UIViewController is in a MainActor context, so this Task | |
// will inherit that, so the following pretend expensive call will | |
// be on the main thread and likely block? | |
ExpensiveOperationPerformer.doExpensiveLoopAndPrint() | |
} |
https://twitter.com/inamiy/status/1489256068995710976
この記事では、補助的な関数として以下のものを用いる。
-- Special case of Control.Arrow.&&&
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** Coq proof that there is no monad compatible with the ZipList applicative functor. *) | |
(** Based on the original proof by Koji Miyazato https://gist.github.com/viercc/38853067c893f7ad9e0894abb543178b *) | |
(** Main theorem: [No_LawfulJoin : forall join, ~(LawfulJoin join)] | |
where [~] means "not" and [LawfulJoin] is the conjunction of the following properties (monad laws): | |
1. [join] is associative: | |
join (join xs) = join (map join xs)] | |
2. [join] is compatible with ZipList's applicative (i.e., [zip_with]): |
NewerOlder