Skip to content

Instantly share code, notes, and snippets.

@gblmarquez
Forked from wsargent/win10-dev.md
Created May 18, 2017 13:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gblmarquez/82ce5bcf10c4d589befdf2ddff843cd7 to your computer and use it in GitHub Desktop.
Save gblmarquez/82ce5bcf10c4d589befdf2ddff843cd7 to your computer and use it in GitHub Desktop.
Windows Development Environment for Scala

Windows 10 Development Environment for Scala

This is a guide for Scala and Java development on Windows, using Windows Subsystem for Linux, although a bunch of it is applicable to a VirtualBox / Vagrant / Docker subsystem environment. This is not complete, but is intended to be as step by step as possible.

Sadly, much of this pertains to Git, GPG, SSH, and Windows all not working, rather than Windows Subsystem for Linux. There is no unified command line experience for native Windows still -- instead, there's a bunch of different conflicting programs which all bring along their own environment and need to be told about each other.

Harden Windows 10

Read the entire Decent Security guide, and follow the instructions, especially:

Be aware that according to Cloudstrike, WSL does expose you to any Ubuntu 14.04 vulnerabilities -- video about 30 minutes in:

Initially known as "Project Astoria" and delivered in beta builds of Windows 10 Threshold 2 for Mobile, Microsoft implemented a full blown Linux 3.4 kernel in the core of the Windows operating system, including full support for VFS, BSD Sockets, ptrace, and a bonafide ELF loader. After a short cancellation, it's back and improved in Windows 10 Anniversary Update ("Redstone"), under the guise of Bash Shell interoperability. This new kernel and related components can run 100% native, unmodified Linux binaries, meaning that NT can now execute Linux system calls, schedule thread groups, fork processes, and access the VDSO!

As it's implemented using a full-blown, built-in, loaded-by-default, Ring 0 driver with kernel privileges, this not a mere wrapper library or user-mode system call converter like the POSIX subsystem of yore. The very thought of an alternate virtual file system layer, networking stack, memory and process management logic, and complicated ELF parser and loader in the kernel should tantalize exploit writers - why choose from the attack surface of a single kernel, when there's now two?

But it's not just about the attack surface - what effects does this have on security software? Do these frankenLinux processes show up in Procmon or other security drivers? Do they have PEBs and TEBs? Is there even an EPROCESS? And can a Windows machine, and the kernel, now be attacked by Linux/Android malware? How are Linux system calls implemented and intercepted?

Install Visual Studio Code

https://code.visualstudio.com/ is good and will be used throughout the examples: it has a command line integration so you can do

code <windows-file>

and have it work.

Install WSL

Install Windows 10 Windows Linux Subsystem.

Note that this will be under %AppData% and so you'll need space on your C: hard drive -- if you've got a laptop or you are tight on space, then you may need to go to some work to move your %AppData% to a different drive. Make sure you use robocopy, and read the entirety of microsoft/WSL#449.

Use lxrun:

lxrun /install /y  // will install as root
lxrun /setdefaultuser wsargent

If you screw it up, uninstall with

lxrun /uninstall /full

If you moved your install according to microsoft/WSL#449 and you can't run /setdefaultuser, make sure that you set the temp folder according to 449#issuecomment-238111556:

EDIT: I forgot something important. After this trick lxrun.exe cant create a new user because it can't access Temp folder. Open an admin CMD and type SET TEMP=E:\Local\Temp pointing to the new Temp location. After that lxrun /install to begin the bash install.

Install ConEmu

Install ConEmu. It is a much better console emulator for using WSL.

Go to Settings, then "Startup" / "Specified named task" and click {Bash::bash}, and then "Save settings". If you don't see "bash" then look at the WSL page that Conemu has.

Set the console height to 9999.

Open up Windows Powershell to install the Powerline fonts on Windows (see below for Git details):

git clone https://github.com/powerline/fonts
cd fonts
powershell -noexit -executionpolicy bypass -File .\install.ps1

Then set the main console font to "Meslo LG M for Powerline"

Install Software in WSL

Install add-apt-repository:

sudo apt-get install software-properties-common
sudo apt-get install python-software-properties

Install the latest version of git:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Install zsh:

sudo apt-get install zsh

Install oh-my-zsh:

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Use agnoster theme by adding the following to $HOME/.zshrc:

ZSH_THEME="agnoster" # this already exists in .zshrc
...

# User configuration
export DEFAULT_USER="wsargent"

Download and install the powerline fonts in WSL:

git clone https://github.com/powerline/fonts
cd fonts
./install.sh

Now change your shell to zsh by editing $HOME/.bashrc (unfortunately chsh doesn't work):

# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi

Install GPG

sudo apt-get install gnupg2

Install JDK 1.8

Technically you can install the JDK, sbt and so on with sdkman. However, I started with a raw install so I'm going to go with it for now:

Open up the Bash window from the start menu. From Bash:

Install Oracle Java 1.8:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

Download Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8 Download:

sudo apt-get install unzip curl
curl -v -j -k -L -H "Cookie:oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip  > jce_policy-8.zip 
unzip jce_policy-8.zip
sudo cp UnlimitedJCEPolicyJDK8/* /usr/lib/jvm/java-8-oracle/jre/lib/security/

Install SBT

Then install SBT on Linux:

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

You will want to be able to publish your artifacts in so that they're accessible by your Windows toolkit (i.e. IntelliJ IDEA). This... is kind of a pain.

You'd think you could just point your ivy2 into Windows so that both WSL and Windows are using the same repository. And it is true, you can set things up like that to start with.

Now when you do a publishLocal, you'll push it to the ivy2 mounted one:

[info] published ivy to /mnt/c/Users/wsargent/.ivy2/local/com.typesafe.play/play-java-forms_2.12/2.6.0-SNAPSHOT/ivys/ivy.xml

but when you try accessing it from the Windows side and start doing things with IDEA, you'll get

[error] com.typesafe.play#sbt-plugin;2.6.0-SNAPSHOT!sbt-plugin.jar origin location must be absolute: C:\Users\wsargent\.ivy2\local\com.typesafe.play\sbt-plugin\scala_2.10\sbt_0.13\2.6.0-SNAPSHOT\jars\sbt-plugin.jar
java.lang.IllegalArgumentException: com.typesafe.play#sbt-plugin;2.6.0-SNAPSHOT!sbt-plugin.jar origin location must be absolute: C:\Users\wsargent\.ivy2\local\com.typesafe.play\sbt-plugin\scala_2.10\sbt_0.13\2.6.0-SNAPSHOT\jars\sbt-plugin.jar
        at org.apache.ivy.util.Checks.checkAbsolute(Checks.java:57)

So the next idea is to use Artifactory. You do this by having Windows 10 Professional, enabling Client Hyper-V, then installing Docker for Windows, then installing the Artifactory docker instance:

docker volume create --name artifactory5_data
docker run --name artifactory-5.0.0 -d -v artifactory5_data:/var/opt/jfrog/artifactory -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest

Then you can go to the localhost:8081 instance and login with "admin/password" and get into Artifactory 5. There should be a "Set me up" section in the middle. Click on either sbt-dev-local, or sbt-release-local, and follow the instructions so that you can publish to artifactory as an intermediary. There's more stuff about sbt repositories at Artifactory.

Then, you want to set up sbt so it points to the artifactory instance for proxy use:

https://www.clever-cloud.com/blog/engineering/2013/11/30/set-up-sbt-for-proxy-use/

TODO Still working on this

Set SBT defaults

Add the following to $HOME/.zshenv:

export JAVA_OPTS="-Xmx2G -Xss2M -XX:MaxMetaspaceSize=512M -XX:ReservedCodeCacheSize=192M -Dfile.encoding=UTF-8"

SBT-PGP

Set up SBT with pgp:

In ~/.sbt/0.13/plugins/gpg.sbt:

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

In ~/.sbt/gpg.sbt:

useGpg := true

General Java Installations

Install other JVM based frameworks with sdkman:

curl -s "https://get.sdkman.io" | bash

i.e. to install Gradle:

source "/home/wsargent/.sdkman/bin/sdkman-init.sh"
sdk install gradle

Access Win10 Mounted FileSystem from WSL

NOTE: You should never try to edit Linux files directly from Windows as you can corrupt your metadata.

You should symlink your Linux project to the Windows filesystem:

mkdir -p /mnt/c/Users/wsargent/work
ln -s /mnt/c/Users/wsargent/work work

Set up an explorer link as a shortcut:

C:\Windows\explorer.exe /n, /e, /select, "C:\Users\wsargent\wsl\work"

You can also specify it as the root:

C:\Windows\explorer.exe /n, /e, /root, "C:\Users\wsargent\wsl\work"

Access X11 Applications

I've tried using IntelliJ IDEA through X11. It's not all that great -- the lag is there and it doesn't show up as a native Windows application. However, it's not all that hard to do.

Install vcXsrv on Windows 10. Start it up and make sure it's working.

Then, install a Window Manager under WSL. Technically you don't need this (you only need X11), but it's much less hassle than working through the libraries individually.

sudo apt-get install xfce4 x11-utils

Edit your startup (.zshrc | .bashrc) file and append the following:

export DISPLAY="localhost:0"

Then, once you've got the DISPLAY environment variable on your system:

xclock

and you should see it appear on your Windows machine.

Access WSL FileSystem from Win10

Setting up the reverse operation of accessing WSL from Windows is a little harder.

Set up SSHD

If you want to get at WSL through SSH, then you have some more work to do.

First you must set up the WSL SSH daemon correctly. This is a pain. Then, you have to make sure you always have a WSL console running. In theory you can run https://github.com/cerebrate/wabash to effectively get a "background" WSL shell, but I haven't tried this.

First, shut off the Windows 10 SSH Service Broker and SSH Server Proxy by going to services.msc and disabling them.

Then, go to Bash / WSL and reinstall OpenSSL with the special settings:

sudo apt-get remove openssh-server
sudo apt-get install openssh-server

Edit the sshd_config file sudo nano /etc/ssh/sshd_config:

AllowUsers yourusername
UsePrivilegeSeparation no

And then restart the service using full-restart:

sudo service ssh --full-restart

After that, you should be able to ssh into localhost and get to the WSL subsystem. Try port 2222 if you're still running into issues.

You can automate this, although it still needs you to keep a WSL shell open at all times...

if [ -z "$(pgrep -fu root /usr/sbin/sshd)" ]; then                                                     
    echo "Starting SSH server:"                                                                        
    ssh –V                 # Displays the currently installed version of SSH                           
    sudo service ssh --full-restart
fi                                                                                                     

Install Win-SSHFS

If you want to edit the Linux subsystem without having to go through the console, then you can mount it through Windows.

Install Win-sshfs 1.5.12.8 and Dokan 0.7.4.

Then mount the drive using your SSH settings. You'll see another drive show up, and you can edit files from there.

There is no inotify support. (not that you'd see it through SFTP anyway). They added it but it won't arrive until March 2017.

Working with Github and Git

By far the easiest thing to do is to set up Github Desktop, aka Github for Windows. It's got a bunch of default settings that do the fiddly things for you.

However, it does not do Git signing out of the box.

You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input from a Git Bash Shell. You'll be working with Git from both Linux and Windows side, so you can do the following in both systems -- see the following for symlink constraints:

git config --global core.autocrlf input
git config --global core.symlinks true

Remember to set up your username and password:

git config --global user.name "Will Sargent"
git config --global user.email "will.sargent@gmail.com"

and set the config behavior:

git config --global push.default simple

Working with IntelliJ IDEA

Intellij IDEA needs to have access to a git executable. Once you've installed Github Desktop, this is going to be under the "PortableGit" directory, e.g.

C:\Users\wsargent\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\cmd\git.exe

From there, as long as you've set the git configuration options you should be fine.

You will also want to point IntelliJ IDEA to the artifactory instance as described above.

SSH Support

To work with Git, you'll need SSH support. Which means you need to set up SSH keys. Github Desktop does this for you automatically, but the boring way also works -- you can create an SSH key and push it to Github under https://github.com/settings/keys.

You will need to do this for both Linux and Windows, if you want to be able to git pull or push from either. It's probably easiest if you mount the ssh credentials from Windows to WSL.

In WSL, set up a symlink:

ln -s /mnt/c/Users/wsargent/.ssh windows_ssh

And then copy all the keys you have into the local (this is because the mounted .ssh will have different permissions):

mkdir $HOME/.ssh
cp -R $HOME/windows_ssh/* $HOME/.ssh
chmod 400 $HOME/.ssh/*

Then change the $HOME/.ssh/config file to take the Github Desktop file, by adding $HOME/.ssh/config:

Host *
        StrictHostKeyChecking no
        UserKnownHostsFile=/dev/null

Host github.com
        StrictHostKeyChecking no
        UserKnownHostsFile=/dev/null
        IdentityFile=~/.ssh/github_rsa

Then test against github:

ssh -vvv git@github.com
Hi wsargent! You've successfully authenticated, but GitHub does not provide shell access.

Pull and Push to Github via SSH

After that, you should be able to clone using ssh transport:

mkdir playframework
cd playframework
git clone git@github.com:wsargent/playframework.git master

and also push to your github remote origin:

git push origin my-bug-fix-branch

and pull:

git pull --rebase

GPG Support

This section is written assuming you use Git for Windows rather than Github Desktop. It should be roughly the same.

I use a Yubikey 4 to do my git commit signing. This means I need a gpg-agent and pinentry for Windows. USB / Smartcard devices like Yubikey are not accessible to WSL at all, so it must be on the Windows Git side.

Install GPG4Win.

Create a shortcut:

"C:\Program Files (x86)\GNU\GnuPG\gpg-connect-agent.exe" /bye

and put the following in a .bat file:

"C:\Program Files (x86)\GNU\GnuPG\gpg-connect-agent.exe" killagent /bye
"C:\Program Files (x86)\GNU\GnuPG\gpg-connect-agent.exe" /bye

GPG4Win has gpg-agent which looks like Pagaent (do not install Pagaent, you don't need it). From a cmd.exe shell:

cd %APPDATA%\gnupg
code gpg-agent.conf

and add the following line:

enable-ssh-support
enable-putty-support

then restart the gpg-connect-agent script. Then make sure GPG4Win has the "enable Putty support" checkbox enabled.

Import your public key, i.e. https://keybase.io/will_sargent/key.asc into GPG4Win.

Install it into WSL:

cd $HOME
wget https://keybase.io/will_sargent/key.asc
gpg --import $HOME/key.asc
gpg: key 2BC6C4B7: public key "William Sargent <will.sargent@gmail.com>" imported

then trust it:

gpg --edit-key 2BC6C4B7
 ~  gpg --edit-key 2BC6C4B7
gpg (GnuPG) 1.4.16; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


pub  2048R/2BC6C4B7  created: 2014-02-16  expires: 2018-02-16  usage: SC
                     trust: unknown       validity: unknown
sub  2048R/26FC797F  created: 2014-02-16  expires: 2018-02-16  usage: E
sub  4096R/D65E090B  created: 2016-09-12  expires: 2017-09-12  usage: A
sub  4096R/267A1666  created: 2016-09-12  expires: 2017-09-12  usage: S
[ unknown] (1). William Sargent <will.sargent@gmail.com>
[ unknown] (2)  William Sargent (Lightbend) <will.sargent@lightbend.com>
[ unknown] (3)  William Sargent (https://keybase.io/will_sargent) <will_sargent@keybase.io>

gpg> trust
pub  2048R/2BC6C4B7  created: 2014-02-16  expires: 2018-02-16  usage: SC
                     trust: unknown       validity: unknown
sub  2048R/26FC797F  created: 2014-02-16  expires: 2018-02-16  usage: E
sub  4096R/D65E090B  created: 2016-09-12  expires: 2017-09-12  usage: A
sub  4096R/267A1666  created: 2016-09-12  expires: 2017-09-12  usage: S
[ unknown] (1). William Sargent <will.sargent@gmail.com>
[ unknown] (2)  William Sargent (Lightbend) <will.sargent@lightbend.com>
[ unknown] (3)  William Sargent (https://keybase.io/will_sargent) <will_sargent@keybase.io>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

pub  2048R/2BC6C4B7  created: 2014-02-16  expires: 2018-02-16  usage: SC
                     trust: ultimate      validity: unknown
sub  2048R/26FC797F  created: 2014-02-16  expires: 2018-02-16  usage: E
sub  4096R/D65E090B  created: 2016-09-12  expires: 2017-09-12  usage: A
sub  4096R/267A1666  created: 2016-09-12  expires: 2017-09-12  usage: S
[ unknown] (1). William Sargent <will.sargent@gmail.com>
[ unknown] (2)  William Sargent (Lightbend) <will.sargent@lightbend.com>
[ unknown] (3)  William Sargent (https://keybase.io/will_sargent) <will_sargent@keybase.io>
Please note that the shown key validity is not necessarily correct
unless you restart the program.

gpg> save

If you want to set up a Yubikey, you should checkout drduh's Yubikey guide.

GPG Command Line Support

You can see the gpg settings, including the agent socket agent-socket:

gpgconf --list-dirs
sysconfdir:C%3a\ProgramData\GNU\etc\gnupg
bindir:C%3a\Program Files (x86)\GNU\GnuPG
libexecdir:C%3a\Program Files (x86)\GNU\GnuPG
libdir:C%3a\Program Files (x86)\GNU\GnuPG\lib\gnupg
datadir:C%3a\Program Files (x86)\GNU\GnuPG\share\gnupg
localedir:C%3a\Program Files (x86)\GNU\GnuPG\share\locale
dirmngr-socket:C%3a\Windows\S.dirmngr
agent-socket:C%3a\Users\wsargent\AppData\Roaming\gnupg\S.gpg-agent
homedir:C%3a\Users\wsargent\AppData\Roaming\gnupg

So from this, GPGPGHOME="C%3a\Users\wsargent\AppData\Roaming\gnupg" and Setting up msysgit and Gpg4win:

Edit the profile file by opening cmd.exe as Administrator, ensuring all copies of Visual Studio Code are closed, and typing:

code "C:\Program Files\Git\etc\profile"

Append the following to profile:

export GNUPGHOME="/c/Users/wsargent/AppData/Roaming/gnupg"

Open Git bash and enter the following:

gpg --list-key

You should now see your keys -- the git bash version of gpg will at least see the filesystem.

From WSL, you can set up your GPG file for ease of use with a symlink, but you won't be able to use it directly:

ln -s /mnt/w/AppData/Roaming/gnupg/ $HOME/windows_gnupg

Git Signing with GPG under Windows

Run the following to set up git commit signing from James McKay:

git config --global user.signingkey CD6970B72D00E5BE9A330EF3C1E8BF062BC6C4B7
git config --global commit.gpgsign true

I'm not sure if you need this line: git config --global gpg.program "c:/Program Files (x86)/GNU/GnuPG/gpg2.exe"

Now, go to one of your git projects under a Windows command prompt:

Type in some text to make sure that git signing is

echo foo >> README
git commit -a -m "Foo"

You should see the GPG4Win pinentry program pop up, and afterwards you can check the signature:

D:\work\docker-cheat-sheet>git log --show-signature -1
commit b71f692b0e2534cec78364dc9df962186db7673b
gpg: Signature made 11/24/16 17:16:18 Pacific Standard Time^M
gpg:                using RSA key A7F14872267A1666^M
gpg: Good signature from "William Sargent <will.sargent@gmail.com>" [ultimate]^M
gpg:                 aka "William Sargent (Lightbend) <will.sargent@lightbend.com>" [ultimate]^M
gpg:                 aka "William Sargent (https://keybase.io/will_sargent) <will_sargent@keybase.io>" [ultimate]^M
Primary key fingerprint: CD69 70B7 2D00 E5BE 9A33  0EF3 C1E8 BF06 2BC6 C4B7^M
     Subkey fingerprint: 0A2F E760 9855 B9B0 DCF3  A915 A7F1 4872 267A 1666^M
Author: Will Sargent <will.sargent@lightbend.com>
Date:   Thu Nov 24 17:16:18 2016 -0800

    testing

Yubikey Support from Git Bash

Git Bash's gpg doesn't like GPG4Win. If you try running GPG from inside a Git Bash shell, you get:

$ gpg --card-status
gpg: detected reader `Yubico Yubikey 4 OTP+CCID 0'
gpg: pcsc_transmit failed: invalid parameter (0x80100004)
gpg: apdu_send_simple(0) failed: invalid value
Please insert the card and hit return or enter 'c' to cancel: c
gpg: selecting openpgp failed: invalid argument
gpg: OpenPGP card not available: general error

If you use "gpg" from your window command prompt, then gpg --card-status will work fine, because it's coming from C:\Program Files (x86)\GNU\GnuPG\pub. So you can do this from Git Bash:

cd "/c/Program Files (x86)/GNU/GnuPG/pub"
./gpg.exe --card-status

The easiest thing to do is to ensure that "/c/Program Files (x86)/GNU/GnuPG/pub" on the PATH (which it is already), and delete the "Git Bash" version.

Check from the Git Bash shell that "GnuPG" is on there:

echo $PATH | grep GnuPG

From the Administrator Command prompt, delete GPG:

cd "C:\Program Files\Git\usr\bin"
rm gpg.exe

Then close the Git Bash shell to try again.

Using gpg-agent instead of ssh-agent

Rather than installing a new ssh-key by hand for each client, I'd like to use my Yubikey and gpg-agent to talk to ssh, work out the public key, and then use that as a transport for Github's git requests.

Also, I'd like to be able to ssh into servers using a Yubikey. Reportedly, you can get this working with Putty, but I'd like to use the command line instead.

I have not found a way to make this work in Windows, either through Cygwin / Git Bash, or through the Windows OpenSSH client.

Using Git Bash NOT WORKING

I have not found how to connect to Github using gpg-agent with Git Bash. You'd think that doing something like:

export SSH_AUTH_SOCK="/c/Users/wsargent/AppData/Roaming/gnupg/S.gpg-agent.ssh"

would work to cross the gap between ssh and gpg-agent, but the way that Cygwin processes Linux sockets is different from Windows.

Using Windows Command Line NOT WORKING

Windows Team is working on a Windows native version of OpenSSH under https://chocolatey.org/packages/openssh.

There is a bug specifically about ssh-agent. If you install Windows OpenSSH from Chocolatey, then it should be there.

choco install openssh

If you don't want to install chocolatey, then there are explicit install instructions.

It looks like setting SSH_AUTH_SOCK to gpg4win does not make ssh happy

set SSH_AUTH_SOCK="C:\Users\wsargent\AppData\Roaming\gnupg\S.gpg-agent.ssh"

Then you get:

D:\work\docker-cheat-sheet>ssh-add
Could not open a connection to your authentication agent.

Windows Restart of Yubikey

The Yubikey is not found when Windows goes to sleep.

There is apparently a hack around it. From McQueen Labs:

As of the time of writing, GPG4Win has issues using Yubikey after the system sleeps or any number of other events. Further, it is desirable to have gpg-agent start automatically when a Yubikey is inserted. To do so, download gpg-agent.bat. Then goto control panel -> administrative tools -> task scheduler and add a new task. Under triggers, make it on an event, from log system, source "WudfUsbccidDrv", event ID 105. Under actions, set it to run gpg-agent.bat. Under conditions, make sure all conditions are unchecked. NOTE: if WudfUsbccidDrv does not appear in the list, you need to reboot and remove and reinsert the Yubikey before adding the task.

Git Things I have not tried

Much of this is baked into Github Desktop, but if you're interested in the details:

Docker Image

I've put a docker image together at https://github.com/wsargent/docker-scala-sbt that puts much of this together in Dockerfiles.

Sundry Errors in WSL

Play's test suite doesn't quite work:

Caused by: java.io.IOException: Too many open files
        at sun.nio.ch.IOUtil.makePipe(Native Method)
        at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:65)
        at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:156)
        ... 64 more

Netty's NetUtil isn't happy with WSL's idea of localhost:

Nov 23, 2016 11:22:03 PM io.netty.util.NetUtil <clinit>
WARNING: Failed to retrieve the list of available network interfaces
java.net.SocketException: Cannot assign requested address (IOCTL SIOCGIFNETMASK failed)
        at java.net.NetworkInterface.getAll(Native Method)
        at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:343)
        at io.netty.util.NetUtil.<clinit>(NetUtil.java:156)

They're still working on network interface enumeration.

Still some very odd sbt behavior where it seems to hang intermittently. Exiting and restarting fixes it.

Encrypted folders

Windows is really terrible with dealing with long path names, and encrypted folders are just as bad. You can sort of get around it by enabling MaxClassFile.scala ~/.sbt/0.13/plugins/MaxClassfileName.scala:

object MaxClassfileName extends AutoPlugin {
  override def trigger = allRequirements
  override def requires = sbt.plugins.JvmPlugin
  override def projectSettings: Seq[Setting[_]] = Seq(
    scalacOptions in Compile ++= Seq("-Xmax-classfile-name", "128")
  )
}

See playframework/playframework#5006 (comment) for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment