Skip to content

Instantly share code, notes, and snippets.

@inlinestyle
inlinestyle / day3.scala
Last active March 19, 2017 00:21
Advent of Code Day 3
import scala.io.Source
object Triangles extends App {
val filename = "input.txt"
val parser = "\\s*(\\d+)\\s*(\\d+)\\s*(\\d+)".r
def isValid(a: String, b: String, c: String): Boolean = {
val sorted = Vector(a, b, c).map(_.toInt).sorted
sorted(2) < (sorted(1) + sorted(0))
}
BEARER='authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWlkIjoiQlUxMTEwMTAwMDAxMTAwODc0MSIsIm1haWQiOiJNQTExMTAxMDAwMDExMDA4NzM3Iiwic3ViZCI6InRlc3Rmb3JjZSIsInVzZXJfaWQiOiJhdXRoMHxCVTExMTAxMDAwMDExMDA4NzQxIiwiZW1haWwiOiJ0ZXN0Zm9yY2VAYml6b2RvLmNvbSIsIm5hbWUiOiJGb3JjZSBBd2FrZW5zIiwiaXNzIjoiaHR0cHM6Ly9zZWFtbGVzc2RvY3NkZXYuYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfEJVMTExMDEwMDAwMTEwMDg3NDEiLCJhdWQiOiJHRk54dWhSa0sweDRwbkVocmJSbzkzUDBCNDBBdlFmMyIsImV4cCI6MTQ4OTAyMzQ0MiwiaWF0IjoxNDg4OTg3NDQyfQ.DbcKYHvjp3GPM0hIO2vsScqJ7eXB26GWmkUUPMRVgVw'
USER_AGENT='user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
# curl 'http://localhost:9000/selectors/forms/replace.json' -H 'origin: https://localhost:3000' -H 'accept-encoding: gzip, deflate, br' -H 'x-requested-with: XMLHttpRequest' -H 'accept-language: en-US,en;q=0.8' -H "$BEARER" -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://localhost:3000/ng/lobby' -H 'author
@inlinestyle
inlinestyle / day4.scala
Last active March 19, 2017 00:21
Advent of Code Day 4
import scala.io.Source
object Obscurity extends App {
type ParsedLine = (String, Integer, String)
val filename = "input.txt"
// parsing "aaaaa-bbb-z-y-x-123[abxyz]", where the first part has an
// arbitrary number of hyphenated sections
val parser = "([\\w-]+)-(\\d+)\\[(\\w{5})\\]".r
@inlinestyle
inlinestyle / day5.scala
Created March 18, 2017 22:15
Advent Of Code Day 5
object Hacking extends App {
val input = "ojvtpuvg"
val messageDigest = java.security.MessageDigest.getInstance("md5")
val emptyPassword: Seq[Option[Char]] = Seq(None, None, None, None, None, None, None, None)
def fiveZeroesIterator(id: String): Iterator[String] = {
Iterator.from(0)
.map {id + _}
<!DOCTYPE html>
<html>
<head>
<title>Hangman Starter</title>
</head>
<body>
<div id="container">
<p id="message"></p>
<img id="hangman" src="https://github.com/ScriptEdcurriculum/solutions2016/blob/master/year1/unit13/project2/images/Hangman-0.png?raw=true"/>
<!DOCTYPE html>
<html>
<head>
<title> Hangman Solution</title>
</head>
<body>
<div id="container">
<p id="message"></p>
<img id="hangman" src="https://github.com/ScriptEdcurriculum/solutions2016/blob/master/year1/unit13/project2/images/Hangman-0.png?raw=true"/>
<div id="word"></div>
@inlinestyle
inlinestyle / README.md
Last active September 10, 2017 14:15
Exported from Popcode. Click to import: http://localhost:3000/?gist=b2b6a8fa00f160e00ccf9ca0c1895994

Sample with python block

Code blocks:

<div>
  hello!
</div>
@inlinestyle
inlinestyle / README.md
Last active August 17, 2017 01:56
Exported from Popcode. Click to import: http://localhost:3000/?gist=f72628405e55bea43267ed91f0bb92dc

An h1 header

(Short markdown sample)

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one
@inlinestyle
inlinestyle / README.md
Last active September 10, 2017 14:17
Exported from Popcode. Click to import: http://localhost:3000/?gist=911a82a17a280545858d2d8ecc557ef3

HTML, CSS, JS, and unnamed code blocks.

Code blocks:

<div>
  hello!
</div>
@inlinestyle
inlinestyle / README.md
Last active September 1, 2017 02:18
Exported from Popcode. Click to import: http://localhost:3000/?gist=882e2a262c80045163efca50e519f34f

An h1 header

great wave!

Code blocks:

<div>
 hello!