Skip to content

Instantly share code, notes, and snippets.

@otkrsk
otkrsk / multiple-ssh-authkeys.md
Last active May 6, 2024 14:12
Add multiple SSH keys to the authorized_keys file to enable SSH authentication when connecting to a server.

Step 1: Generate first ssh key Type the following command to generate your first public and private key on a local workstation. Next provide the required input or accept the defaults. Please do not change the filename and directory location.

workstation 1 $ ssh-keygen -t rsa

Finally, copy your public key to your remote server using scp

Jitpack

https://jitpack.io

For testing purposes, the easiest way to go is jitpack:

resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.User" % "Repo" % "Tag"
@haasn
haasn / about:config.md
Last active April 2, 2024 18:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@karpathy
karpathy / min-char-rnn.py
Last active May 6, 2024 16:42
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)

In order to build SuperCollider 3.6.5 from source on Linux (Debian), the following steps were necessary on a fresh system:

sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libfftw3-dev
sudo apt-get install libqt4-dev
sudo apt-get install libqtwebkit-dev
sudo apt-get install libjack-jackd2-dev
sudo apt-get install libsndfile1-dev
@pedrofurla
pedrofurla / Macros.scala
Created January 11, 2014 20:38
Example of how to get source locations using scala macros
package slickdemo
import scala.reflect.macros.Context
import scala.language.experimental.macros
object Macros {
// scala.reflect.runtime.currentMirror
// universe.reify
@johnynek
johnynek / JsonInjectionExample
Last active December 23, 2015 18:09
Json injection example with case classes to Maps.
scala> case class Wrapped(x: Int, y: Long)
defined class Wrapped
scala> import com.twitter.bijection._
import com.twitter.bijection._
scala> import com.twitter.bijection.json._
import com.twitter.bijection.json._
scala> import com.twitter.bijection.json.JsonNodeInjection._
@retronym
retronym / namespace-management.md
Last active December 21, 2015 20:49
namespace-management.md

Namespace Management (DRAFT)

Purpose

This document describes the guidelines for managing two important namespaces: the package scala._, and the Maven group org.scala-lang.

These questions become more important as we modularize the distribution, and as we publish new modules (such as ScalaJS, scala-async, scala-pickling.)

@andrewconner
andrewconner / FutureGoodies.scala
Last active May 4, 2016 11:34
SafeFuture, TimeoutFuture, CancelableFuture implementations. See https://eng.42go.com/future-safefuture-timeout-cancelable for further explanation.Thanks to @bretthoerner for spotting an error!
/* We've run into a few common pitfalls when dealing with Futures in Scala, so I wrote these three helpful
* classes to give some baked-in functionality.
*
* I'd love to hear about other helpers you're using like these, or if you have improvement suggestions.
* github@andrewconner.org / @connerdelights
*/
import scala.concurrent.{ExecutionContext, CanAwait, Awaitable, Future, Promise}
import scala.concurrent.duration.Duration
import scala.util.Try
object Trimmed {
val Stop = ".*\\b(a|an|the|to|of|as|in|with|for)$".r
val Fine = "(.+\\.)$".r
val Punc = "(.+)[,;:]$".r
}
class Trimmed(size: Int) {
def unapply(s: String) = s.replaceAll("\\s+", " ") match {
case res if res.size <= size => Some(res)
case res => res.split(' ').inits.map(_ mkString " ").flatMap {