Skip to content

Instantly share code, notes, and snippets.

View zmactep's full-sized avatar

Pavel Yakovlev zmactep

View GitHub Profile
@zmactep
zmactep / alpaca.py
Created April 5, 2023 08:46
Chat with alpaca-lora
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import argparse
import os.path as osp
from typing import Union
import torch
from transformers import GenerationConfig, LlamaForCausalLM, LlamaTokenizer
@zmactep
zmactep / whisper
Created April 4, 2023 08:18
Small script to transcribe voice messages
#!/bin/sh
# Install whisper.cpp from here: https://github.com/ggerganov/whisper.cpp
# You may also need ffmpeg for conversion
WHISPER_PATH=/Users/pavel/.local/share/whisper.cpp
MODEL="large"
usage()
{
@zmactep
zmactep / generate-web-app.sh
Created February 23, 2019 21:44
Generate web app with Webpack 4, Babel 7 and Stylus
#!/bin/sh
DIR=$(basename "`pwd`")
# Setup nodeJS project
cat > package.json <<EOF
{
"name": "$DIR",
"version": "1.0.0",
"description": "",
@zmactep
zmactep / Integrator.hs
Last active October 31, 2017 12:06
MD Integrators
-- Based on http://www2.mpip-mainz.mpg.de/~andrienk/journal_club/integrators.pdf
{-# LANGUAGE NoImplicitPrelude #-}
module Integrator where
import Data.Array.Accelerate
import Data.Array.Accelerate.Linear
import Data.Array.Accelerate.Control.Lens
type R = Float
@zmactep
zmactep / Main.hs
Created October 20, 2017 09:53
System Fomega
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
module Main where
-- Integer and Boolean literals
data Lit = LInt Int
| LBool Bool
deriving (Show, Eq, Ord)
@zmactep
zmactep / encodings.md
Created August 20, 2017 13:08
Number encodings

Alternative to the Church, Scott and Parigot encodings of data on the Lambda Calculus.

When it comes to encoding data on the pure λ-calculus (without complex extensions such as ADTs), there are 3 widely used approaches.

Church Encoding

The Church Encoding, which represents data structures as their folds. Using Caramel’s syntax, the natural number 3 is, for example. represented as:

0 c0 = (f x -> x)
1 c1 = (f x -> (f x))
2 c2 = (f x -&gt; (f (f x)))
2017-03-28 11:45:28 +0300
cmake
--build
.
/usr/local/Cellar/cmake/3.7.2/bin/cmake -H/tmp/llvm-4.0-20170328-2197-1mw2b8z/llvm-4.0.0.src -B/tmp/llvm-4.0-20170328-2197-1h2a439 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_progress_start /tmp/llvm-4.0-20170328-2197-1h2a439/CMakeFiles /tmp/llvm-4.0-20170328-2197-1h2a439/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f lib/Demangle/CMakeFiles/LLVMDemangle.dir/build.make lib/Demangle/CMakeFiles/LLVMDemangle.dir/depend
@zmactep
zmactep / Functor.scala
Created May 17, 2016 09:04
Scala Functor
/*
class Functor f where
fmap :: (a -> b) -> f a -> f b
*/
trait Functor[F[_]] {
def fmap[A, B](f : F[A])(g : A => B) : F[B]
}
class Telnet extends Actor with ActorLogging {
override def receive : Receive = {
case Connected(remote, _) =>
log.info(s"Incoming connection from: $remote")
val handler = context.actorOf(Props[SimplisticHandler])
sender() ! Register(handler)
}
}
class SimplisticHandler extends Actor with ActorLogging {
@zmactep
zmactep / lazy_bomb_test.scala
Last active January 8, 2016 13:41
Funny bomb test on scala lazy
sealed trait BombLike {
def power : Int
def name : String
}
case class Bomb(power : Int, name : String) extends BombLike {
println("Explosion!")
}
case object Clock extends BombLike {