Skip to content

Instantly share code, notes, and snippets.

View vinitS101's full-sized avatar

Vinit Singh vinitS101

View GitHub Profile
@gnprice
gnprice / .gitconfig
Last active December 22, 2023 20:53
gitconfig
# This is a snapshot of my ~/.gitconfig file, minus a few bits
# that are obsolete or non-reusable.
#
# For explanation of each setting, see `git help config`
# or https://git-scm.com/docs/git-config .
#
[user]
name = Greg Price
email = gnprice@gmail.com
[alias]
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 19, 2024 17:20
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@hanbei
hanbei / KnnSimple
Created August 27, 2013 18:46
Simplest Knn implementation in Scala
class KnnSimple {
var trainData: List[Array[Double]] = null
def train(trainData: List[Array[Double]]) {
this.trainData = trainData
}
def nearestNeighbour(k: Int, point: Array[Double]) : List[Array[Double]] = {
nearestNeighbour(k, point, (x, y) => Math.sqrt(x.zip(y).map(pair => (pair._1 - pair._2) * (pair._1 - pair._2)).sum))