Skip to content

Instantly share code, notes, and snippets.

@evfro
evfro / hybridsvd.py
Last active May 5, 2025 15:10
HybridSVD example
from scipy.sparse import csr_matrix
import scipy as sp
import numpy as np
from scipy.sparse.linalg import spsolve_triangular
# rating matrix
a = np.array([[1, 0, 1, 1, 0],
[1, 1, 0, 1, 0],
[1, 0, 0, 1, 0]])
@xiongjia
xiongjia / 0_main.cxx
Last active September 11, 2022 01:39
A simple sample of Boost Log #devsample #boost
/**
* A simple sample of Boost Log
*/
#pragma warning(push)
#pragma warning(disable:4819)
# include <boost/shared_ptr.hpp>
# include <boost/date_time/posix_time/posix_time_types.hpp>
# include <boost/log/trivial.hpp>
# include <boost/log/core.hpp>
@takluyver
takluyver / ipytables.py
Created March 6, 2013 11:57
IPyTables
class TableCell(object):
bg_colour = None
def __init__(self, value, header=False, bg_colour=None, text_colour=None):
self.value = value
self.header = header
self.bg_colour = bg_colour
self.text_colour = text_colour
def _make_css(self):
@(page:Int, pageLength:Int, collectionLength:Int, route:Int => Call, bound:Int = 5)
@lowbound() = @{
((page.toDouble / bound).floor * bound) toInt
}
@highbound() = @{
if ((lowbound() + bound) * pageLength >= collectionLength)
collectionLength / pageLength + 1
else
lowbound() + bound
}
@casualjim
casualjim / WebSocketClient.scala
Created February 13, 2012 19:42
A Netty based WebSocket client and server in scala
package mojolly.io
import org.jboss.netty.bootstrap.ClientBootstrap
import org.jboss.netty.channel._
import socket.nio.NioClientSocketChannelFactory
import java.util.concurrent.Executors
import org.jboss.netty.handler.codec.http._
import collection.JavaConversions._
import websocketx._
import java.net.{InetSocketAddress, URI}