Skip to content

Instantly share code, notes, and snippets.

View trylks's full-sized avatar
🤖
Automating

trylks trylks

🤖
Automating
View GitHub Profile
@trylks
trylks / Pipfile
Last active January 31, 2023 12:17
minimal working example pytest fastapi multiprocessing (not working)
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pytest = "*"
fastapi = "*"
requests = "*"
uvicorn = "*"
@trylks
trylks / CurseOfDimensionality.ipynb
Created August 19, 2022 13:01
Curse of dimensionality
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trylks
trylks / CurseOfDimensionality.ipynb
Created August 19, 2022 12:36
Curse of dimensionality
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trylks
trylks / index.html
Last active March 21, 2018 19:01
I just wanted a cleaner view, sorry
<html><head><title>too much stuff around to just share a video...</title></head><body>
<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/igpB6hm57YxdC-5PUt8Z5w/172095725562" data-did="4cff748eb40aa96b418284368459b401e8d86715">
<a href="http://pordondemeda.tumblr.com/post/172095725562/luisonte-el-tío-ya-sospecha-desde-el-principio">http://pordondemeda.tumblr.com/post/172095725562/luisonte-el-tío-ya-sospecha-desde-el-principio</a>
</div>
<script async src="https://assets.tumblr.com/post.js"></script>
<p>To be viewed at: <a href="https://cdn.rawgit.com/trylks/c4f6f2d4a2c14fc6e7f9dd7d493ed01f/raw/a7614ae9066cdb59f84391e272a0df159e0ed374/index.html">rawgit</a></p>
</body></html>
@trylks
trylks / 0_README.md
Last active July 17, 2016 22:36
Five small programming problems.

It's Friday night, I'm too tired to do anything useful, but not enough to sleep. I find five small programming katas and I decide that I can start the weekend procrastination already. They are meant to be programmed in the language you feel most comfortable with. Unfortunately, I don't feel comfortable with any language, therefore I used several of them.

PS: Upon closer inspection, probably I should learn Hy.

import nltk
from nltk.probability import LidstoneProbDist
from nltk.model.ngram import NgramModel
import pandas as pd
tweets = pd.read_csv('tweeets.csv')
tokenize = lambda x: nltk.word_tokenize(str(x))
train = [tokenize(text) for text in tweets[tweets.user == 'trylks']['text']]
text = tokenize("I think that the #Python library #nltk is great")
@trylks
trylks / eager_lazy_value.scala
Created October 28, 2014 18:15
Introducing the concept of eager laziness in a rudimentary way
package main
import scala.concurrent._
import ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
import java.util.Calendar
object LazyEagerValues {
def toFuture[A, B](f: A => B): A => Future[B] = x => future { f(x) }
@trylks
trylks / compareSum.scala
Last active August 29, 2015 14:06
Tests for some ways to implement summation in Scala. Something to consider.
package main
import scala.language.implicitConversions
object SomeTests {
implicit def traversableToFolder[A](traversable: Traversable[A]) = new Folder[A](traversable)
class Folder[A](val list: Traversable[A]) {
def foldFor[B](start: B)(op: ((B, A) => B)): B = {
@trylks
trylks / Allocate.scala
Last active August 29, 2015 14:06
Programming kata suggested by a friend, formulation not available at this moment.
package main
import collection.JavaConversions._
object Allocator {
def main(args: Array[String]) {
val intargs = args.map(_.toInt)
println(allocate(intargs(0), intargs.slice(1, intargs.size).toVector))
}
package main
import scala.concurrent._
import ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
object NCApp {
def main(args: Array[String]) = {
val l = 1 to 100