Skip to content

Instantly share code, notes, and snippets.

@whiter4bbit
whiter4bbit / main.rs
Created December 24, 2019 19:02
day 24b
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::collections::HashSet;
type Cell = (isize, isize, isize);
struct Grid {
rows: isize,
cols: isize,
bugs: HashSet<Cell>,
@whiter4bbit
whiter4bbit / main.rs
Created December 24, 2019 19:02
day 24b
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::collections::HashSet;
type Cell = (isize, isize, isize);
struct Grid {
rows: isize,
cols: isize,
bugs: HashSet<Cell>,
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::collections::{VecDeque, HashMap, HashSet};
type Pos = (i32, i32);
#[derive(Debug, Clone)]
enum Tile {
Free, Key(usize), Door(usize),
}
extern crate num_complex;
extern crate ordered_float;
use std::fs::File;
use std::collections::HashSet;
use std::io::{BufRead, BufReader, Result};
use ordered_float::OrderedFloat;
use num_complex::Complex;
type Theta = OrderedFloat<f32>;
use std::io::{Error, ErrorKind, Result};
use std::rc::Rc;
use std::cell::RefCell;
use crate::int_code::{IntCodeProg, OpResult};
fn perms_rec(res: &mut Vec<Vec<i64>>, vec: &mut Vec<i64>, from: usize) {
if from == vec.len() {
res.push(vec.clone());
} else {
for i in from..vec.len() {
use std::fs::File;
use std::io::{BufReader, Result};
use std::io::prelude::*;
type Instr = i32;
trait InstrOps {
fn is_immediate_param(self, nth: usize) -> bool;
}
public final class InVar {
private static final InheritableThreadLocal<String> S = new InheritableThreadLocal<String>() {
@Override
protected String childValue(String parentValue) {
System.out.println("Child called");
return parentValue + "b";
}
};
public static void main(String[] args) throws Exception {
import org.apache.flume.sink.elasticsearch.ContentBuilderUtil;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
public class JsonPlay {
public static void main(String[] args) throws Exception {
XContentBuilder strangeBuilder = XContentFactory.jsonBuilder().startObject();
ContentBuilderUtil.appendField(strangeBuilder, "data", "1\t{\"areYouSure\":\"thatItisvalidJson\"}".getBytes());
System.out.println(strangeBuilder.bytes().toUtf8());
package persistence
import akka.actor._
import akka.persistence._
import akka.event.Logging
import com.typesafe.config.ConfigFactory
import AtLeastOnceDelivery.{UnconfirmedDelivery, UnconfirmedWarning, AtLeastOnceDeliverySnapshot}
object SimpleJournalActor {
case class Command(cmd: Any, id: Long)
package persistence
import akka.actor._
import akka.event.Logging
import akka.persistence._
import AtLeastOnceDelivery.{UnconfirmedDelivery, UnconfirmedWarning}
import scala.annotation.tailrec
import scala.collection.immutable.ListMap
import java.util.UUID