This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Algo { | |
//Uxr@yjA9!mvKMNpDpn.- | |
// number of decodings | |
// | |
public int numDecodings(String s) { | |
if(s.startsWith("0")) { | |
return 0; | |
} | |
int[] count = new int[s.length() + 1]; | |
count[0] = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pushd /tmp/ | |
curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ | |
| grep "browser_download_url.*hugo_[^extended].*_Linux-64bit\.tar\.gz" \ | |
| cut -d ":" -f 2,3 \ | |
| tr -d \" \ | |
| wget -qi - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function run_docker_on_mac_if_not_running() { | |
echo "docker starting" | |
if (! docker stats --no-stream ); then | |
echo "Opening docker" | |
# Change location of app if different | |
open /Applications/Docker.app | |
# Wait until Docker daemon is running and has completed initialisation | |
while (! docker stats --no-stream ); do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Date( | |
var day: Int, | |
var month: Int, | |
var year: Int | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ConsecutiveDuplicates { | |
def compress(xs: List[Char]): List[Char] = xs match { | |
case Nil => Nil | |
case _ :: Nil => xs | |
case x :: y :: rest => if (x == y) compress(y :: rest) else x :: compress(y :: rest) | |
} | |
def main(args: Array[String]): Unit = { | |
val chars = List('a', 'a', 'a', 'a', 'b', 'c', 'c', 'a', 'a', 'd', 'e', 'e', 'e', 'e') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- ShiftIt - window manage | |
- Evernote | |
- flux - yellow screen | |
- shazam - music surround | |
- spotify | |
- caffine - No sleep for mac | |
- ccmenu - GOCD plugin | |
- alfred - shortcut for opening things. | |
- flycut - multiple copy paster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "git pull --rebase git://`ipconfig getifaddr en0`/`basename $PWD` `git symbolic-ref --short HEAD`" | |
git daemon --base-path=.. --informative-errors --verbose --export-all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javaexample; | |
import java.util.ArrayList; | |
import java.util.List; | |
import static com.javaexample.EnumListExample.MeasureType.M1; | |
import static com.javaexample.EnumListExample.MeasureType.M2; | |
import static com.javaexample.EnumListExample.UnitType.U1; | |
import static com.javaexample.EnumListExample.UnitType.U2; |