Skip to content

Instantly share code, notes, and snippets.

View cvogt's full-sized avatar

Jan Christopher Vogt cvogt

  • Symbiont.io
View GitHub Profile
@cvogt
cvogt / gist:0b681c6edfce504ca3553b336ca55ef7
Created January 9, 2019 19:56 — forked from jfeilbach/gist:fd109c7dbc9798ce6e47358b82d0be76
DNS over TLS (knot resolver) setup using 1.1.1.1 on macOS
# Configuring DNS-over-TLS on macOS
# Worked on macOS 10.13.4
brew -v update
brew -v doctor
# Next two commands are optional
sudo chown -R $(whoami) $(brew --prefix)/*
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
# Install DNS client
brew install knot-resolver
# Should be installed to something like: /usr/local/Cellar/knot-resolver/2.3.0/sbin/kresd
@cvogt
cvogt / vimeo-download.py
Last active December 26, 2018 08:29 — forked from alexeygrigorev/vimeo-download.py
Downloading segmented video from vimeo
#!/usr/bin/env python2.7
# https://gist.github.com/cvogt/1e46597e39bfe0e0aee8d5348123ca03
# based on https://gist.github.com/alexeygrigorev/a1bc540925054b71e1a7268e50ad55cd#file-vimeo-download-py
# also see https://github.com/eMBee/vimeo-download
import requests
import base64
import sys
from tqdm import tqdm
package com.pretend.myforklift
import com.liyaos.forklift.slick.{ SlickCodegen, SlickMigrationCommandLineTool, SlickMigrationCommands, SlickMigrationManager }
import scala.io.StdIn
trait MyMigrationCommands extends SlickMigrationCommands
with MyMigrationFilesHandler {
this: SlickMigrationManager with SlickCodegen =>

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

@cvogt
cvogt / demo.sh
Created September 6, 2016 06:56 — forked from paulp/demo.sh
Enabling sbt plugins from the command line in any sbt project
% sbtx dependencyGraph
... blah blah ...
[info] *** Welcome to the sbt build definition for Scala! ***
[info] Check README.md for more information.
[error] Not a valid command: dependencyGraph
[error] Not a valid project ID: dependencyGraph
% sbtx -Dplugins=graph dependencyGraph
... blah blah ...
@cvogt
cvogt / A.markdown
Last active August 29, 2015 14:27 — forked from umpirsky/A.markdown
Sublime Text Monokai Sidebar Theme.
@cvogt
cvogt / mini.scala
Last active August 29, 2015 14:22 — forked from etorreborre/mini.scala
import org.specs2._
import execute._
import specification._
import core._
class TestSuite(tests: Fragment*) extends Specification {
def is = br ^ Fragments.foreach(tests)(f => Fragments(f, br))
}
object TestSuite {
@cvogt
cvogt / nope.scala
Last active August 29, 2015 14:17 — forked from paulp/nope.scala
import Predef.{any2stringadd => _,_}
// GUESS THE INFERRED TYPE FOR ys!
class :=[T,Q]
object := {
/** Ignore default */
implicit def useProvided[P, D] : P := D = new (P := D)
/** Infer type argument to default */
implicit def useDefault[D] : D := D = new (D := D)
}
package com.sport195.api
import play.api.libs.json._
import scala.language.experimental.macros
object ImplicitConversions {
import java.sql.Timestamp
import java.sql.Date
implicit val x = scala.language.implicitConversions
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#