Skip to content

Instantly share code, notes, and snippets.

View phdoerfler's full-sized avatar

Philipp Dörfler phdoerfler

View GitHub Profile
@mslinn
mslinn / sbtDeps
Created July 12, 2012 21:13
Shows all dependencies of an SBT project
#!/bin/bash
echo "Direct dependencies"
sbt 'show all-dependencies' | \
gawk 'match($0, /List\((.*)\)/, a) {print a[1]}' | \
tr -d ' ' | tr ',' '\n' | sort -t ':' | \
tr ':' '\t' | expand -t 30
echo -e "\nAll dependencies, including transitive dependencies"
sbt 'show managed-classpath' | tr -d ' ' | tr ',' '\n' | \
@tinkerware
tinkerware / Vagrant provision block
Last active January 21, 2019 01:11
Install Latest Java 7 and Java 8 on Ubuntu 14.04 LTS
config.vm.provision "shell", inline: <<-SHELL
apt-get -y -q update
apt-get -y -q upgrade
apt-get -y -q install software-properties-common htop
add-apt-repository ppa:webupd8team/java
apt-get -y -q update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get -y -q install oracle-java8-installer
apt-get -y -q install oracle-java7-installer
@stepancheg
stepancheg / gist:167566
Created August 14, 2009 01:15
How to convert Scala XML to JDK DOM
object XmlHelpers {
val docBuilder =
javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder()
}
class NodeExtras(n: Node) {
def toJdkNode(doc: org.w3c.dom.Document): org.w3c.dom.Node =
n match {
case Elem(prefix, label, attributes, scope, children @ _*) =>
// XXX: ns
@DamienCassou
DamienCassou / configuration.nix
Created October 22, 2014 13:41
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
let
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# I use VirtualBox to connect to Windows and Linux guests
@seyonv
seyonv / Focusmate_num_sessions_v1.rb
Last active January 19, 2022 15:08
File to get the current total number of sessions in Focusmate
require 'json'
require 'pry'
require 'uri'
require 'net/http'
class FocusMateNumSessions
# Step 1. Create a file somewhere in your filesystem.
# Call it fm_token_file.txt. Insert the path to the file into the line below
# Make sure to look at the reference .txt file and just paste
# that over.
@kpmeen
kpmeen / TablePrinter.scala
Last active March 5, 2022 12:52
Scala code for generating an ASCII table for a given data set. The implementation handles ANSI colours by depending on Fansi (https://github.com/lihaoyi/fansi) by Li Haoyi.
import fansi.Str
import org.slf4j.LoggerFactory
import scala.util.Try
import scala.util.control.NonFatal
object TablePrinter {
val logger = LoggerFactory.getLogger(TablePrinter.getClass)
@chrisdarroch
chrisdarroch / idea
Created October 17, 2013 03:40
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
@guilgaly
guilgaly / 1 - scalac options 2.13.scala
Last active September 21, 2023 14:45
Scala compiler options I typically use
val scalacOptions = Seq(
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-Ybackend-parallelism", //
"8",
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
// "-Ymacro-annotations", // Enable support for macro annotations, formerly in macro paradise.
@bobthecow
bobthecow / tab.bash
Last active November 10, 2023 08:47
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@normoes
normoes / get_files_and_info_from_docker_container.md
Created March 1, 2019 15:12
Get files and information from a docker container

This can be used to retreive files/binaries/information from docker containers.

#!/bin/bash

set -Eeuo pipefail

mkdir ./binary || true

# build most recent docker image