Skip to content

Instantly share code, notes, and snippets.

View dpnova's full-sized avatar
🥸
hacking the gibson

David Novakovic dpnova

🥸
hacking the gibson
View GitHub Profile
@enisdenjo
enisdenjo / graphiql-over-ws.html
Last active December 20, 2023 05:32
GraphiQL ❤️ graphql-ws
<!--
* Copyright (c) 2021 GraphQL Contributors
* All rights reserved.
*
* This code is licensed under the MIT license.
* Use it however you wish.
-->
<!DOCTYPE html>
<html>
<head>
@dcaoyuan
dcaoyuan / akka-http-client.scala
Created August 26, 2016 12:23
akka-http-client-example
val uri = "http://www.yahoo.com"
val reqEntity = Array[Byte]()
val respEntity = for {
request <- Marshal(reqEntity).to[RequestEntity]
response <- Http().singleRequest(HttpRequest(method = HttpMethods.POST, uri = uri, entity = request))
entity <- Unmarshal(response.entity).to[ByteString]
} yield entity
val payload = respEntity.andThen {
@heathermiller
heathermiller / scala-cheatsheet.md
Last active August 7, 2025 13:02
Scala Cheatsheet

This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.

Evaluation Rules

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if need be
    def example = 2      // evaluated when called
    val example = 2      // evaluated immediately
@proclamo-zz
proclamo-zz / README.md
Last active November 2, 2025 23:15
Lineal regression test with Math.js

A simple linear regression test with Math.js using normal equations solution (based on Coursera's Machine Learning Course). You can view the interpolated values moving the mouse over the calculated line.

Run "bower install" and watch the console output.

@quiver
quiver / trie-autocomplete.py
Created April 4, 2013 15:47
trie-based autocomplete using redis/python
# vim: set fileencoding=utf8
'''
References
- http://stackoverflow.com/a/1966188
- http://en.wikipedia.org/wiki/Tree_(data_structure)
$ python suggest.py prefix
'''
import sys
import redis
@oubiwann
oubiwann / config.py
Created October 10, 2012 21:16
Memcache, Twisted Templates, and the Klein Mirco-webframework
"""
A simple configuration file.
"""
cache = True
debug = True
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 8, 2025 14:38
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jonathana
jonathana / grouplens_evaluator.py
Created June 22, 2011 20:15
"Mahout in Action" Grouplens evaluator sample from section 2.5 ported to jython
import sys, os, glob
from datetime import datetime
sys.path.append(os.environ.get("MAHOUT_CORE"))
for jar in glob.glob(os.environ.get("MAHOUT_JAR_DIR") + "/*.jar"):
sys.path.append(jar)
from org.apache.mahout.common import RandomUtils
from org.apache.mahout.cf.taste.common import TasteException
from org.apache.mahout.cf.taste.eval import *
import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> objectJSONEncoder().encode(obj)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""