Instantly share code, notes, and snippets.


Extra assignments

Here are some extra assignments for everyone who has finished the database homework and couldn't get enough ;).


Indices are a very important feature to make queries faster.

  1. What is a database index? Explain in your own words.
View MachineLearning1.scala
import spire.implicits._
import spire.math._
class MachineLearning1[Number](implicit fractional: Fractional[Number]) {
import fractional.pow
private def number(integer: Int): Number = fractional.fromInt(integer)
type Hypothesis = Number => Number
View ComplexNumber.cs
namespace Lateralus {
public struct ComplexNumber {
public readonly double Direct; // Real part
public readonly Lateral Lateral; // Imaginary part
public ComplexNumber(double direct, Lateral lateral) {
Direct = direct;
Lateral = lateral;
View BulletThreadingUnity.cs
using System.Diagnostics;
using System.Threading;
using BulletSharp;
using BulletSharp.Math;
using BulletUnity;
using UnityEngine;
using Vector3 = BulletSharp.Math.Vector3;
public class MultithreadingTest : MonoBehaviour {
private MotionState _bodyView;
View QuartzObservable.scala
package org.frankversnel.rxquartz
import java.time.Instant
import java.util.UUID
import scala.concurrent.{ExecutionContext, Promise, Future}
import com.typesafe.scalalogging.Logger
import org.quartz._
import rx.lang.scala.{Observer, Subscription, Observable}
using System.Net;
using System.Net.Sockets;
using UnityEngine.Networking;

var address = IPAddress.Parse("");
int port;
using (var tempSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
    tempSocket.Bind(new IPEndPoint(address, port: 0));
    port = ((IPEndPoint) tempSocket.LocalEndPoint).Port;
View raknet compilation.txt
frank@ui:~/Desktop/RakNet/DependentExtensions/Swig$ ./ ../../Source/
Performing Swig build
without SQLiteClientLogger
../../Source/RakNetDefines.h:28: Warning 305: Bad constant value (ignored).
../../Source/RakPeer.h:57: Warning 401: Nothing known about base class 'RNS2EventHandler'. Ignored.
../../Source/NatTypeDetectionClient.h:45: Warning 401: Nothing known about base class 'RNS2EventHandler'. Ignored.
../../Source/NatTypeDetectionServer.h:55: Warning 401: Nothing known about base class 'RNS2EventHandler'. Ignored.
../../Source/RakWString.h:40: Warning 503: Can't wrap 'operator wchar_t*' unless renamed to a valid identifier.
Swig build complete
Removing and replacing the sample cs files with fresh ones
View Compression.cs
using System;
using UnityEngine;
namespace RamjetAnvil.Networking {
public static class Compression {
public static class Rotation {
private const float Minimum = -1.0f / 1.414214f; // note: 1.0f / sqrt(2)
private const float Maximum = +1.0f / 1.414214f;
View FunctionalEntitas.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Entitas.Functional {
/// <summary>
/// TODO Naming systems with string instead of Type
View GameObjectFactory.cs
using System;
using UnityEngine;
namespace RamjetAnvil.GameObjectFactories
public struct ObjectFactory {
private readonly bool _isObjectActive;
private readonly Func<GameObject> _instantiator;
public ObjectFactory(bool isObjectActive, Func<GameObject> instantiator) {