Skip to content

Instantly share code, notes, and snippets.

fn main() {
let n = usize::MAX/10;
println!("Part 1");
println!("Q: {}, A: {}", n, steal_from_left(n));
println!("Part 2");
println!("Q: {}, A: {}", n, steal_across(n));
}
/*
OUTPUT:
using System.Collections;
using UnityEngine;
namespace Sorter
{
[RequireComponent(typeof(MeshRenderer))]
public class RandomTexture : MonoBehaviour
{
[SerializeField] private Vector2Int textureDimension = new Vector2Int(128, 128);
@jostly
jostly / gist:4563579
Created January 18, 2013 10:08
The trouble with hashCode in mutable objects
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Set<Foo> set = new HashSet<Foo>();
Foo apple = new Foo("apple");
@jostly
jostly / Dockerfile
Created December 3, 2015 22:04
Dockerfile for running Swift 2.2 development snapshot on Ubuntu 15.10
FROM ubuntu:15.10
WORKDIR /root
RUN apt-get -y update
RUN apt-get -y install clang curl libpython2.7 libicu55
RUN curl -o swift.tgz https://swift.org/builds/ubuntu1510/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10.tar.gz
RUN tar --strip-components=1 -C / -xzf swift.tgz

Keybase proof

I hereby claim:

  • I am jostly on github.
  • I am jostly (https://keybase.io/jostly) on keybase.
  • I have a public key whose fingerprint is 11B0 ACD5 9E2D FD24 F4E8 7C79 B2A9 7817 CD91 D38C

To claim this, I am signing this object:

@jostly
jostly / gist:1fc37cb8cc99f53f91e4
Created November 4, 2014 10:25
Hexdump for Java byte array
StringBuilder output = new StringBuilder();
int col = 0;
int pos = 0;
String[] chars = new String[16];
for (byte b : array) {
if (col == 0) {
output.append("\n" + String.format("%04x", pos) + ": ");
}
output.append(String.format("%02x ", b));
if (b > 31 && b < 128) {