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
// Definition for a binary tree node. | |
#[derive(Debug, PartialEq, Eq)] | |
pub struct TreeNode { | |
pub val: i32, | |
pub left: Option<Rc<RefCell<TreeNode>>>, | |
pub right: Option<Rc<RefCell<TreeNode>>>, | |
} | |
impl TreeNode { | |
#[inline] |
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
struct Node { | |
value: Symbol, | |
children: (Option<Box<Node>>, Option<Box<Node>>), | |
} | |
let movechild = ((&root).as_ref().unwrap().children).1; | |
(&mut root).as_mut().unwrap().children.1 = Some(Box::new(Node::new(symbol, (movechild, None)))); |
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
fn split_with_matches<F>(s: &str, f: F) -> Vec<&str> where | |
F: Fn(char) -> bool { | |
let mut out: Vec<&str> = vec![]; | |
let mut curstring: String = String::new(); | |
for c in s.chars() { | |
if f(c) { | |
out.push(&curstring); | |
out.push(&c.to_string()); | |
} else { | |
curstring.push(c); |
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
abstract class SpaceObject() { | |
type T <: SpaceObject | |
def ===(that: T): Boolean | |
} | |
class Sphere(val transform: Matrix, val material: Material) extends SpaceObject { | |
type T = Sphere |
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
def encodePair(pair: (Char, Char)): (Char, Char) = { | |
(findLetterInSquare(pair._1), findLetterInSquare(pair._2)) match { | |
case ((A, B), (A, D)) => (indexToLetter((A, (B+1)%5)), indexToLetter((A, (D+1)%5))) // same row | |
case ((A, B), (C, B)) => (indexToLetter(((A + 1)%5, B)), indexToLetter(((C+1)%5, B))) // same column | |
case ((A, B), (C, D)) => (indexToLetter((A, D)),indexToLetter((C, B))) | |
} | |
} |
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
def sum_vector(x: Array[Int], y: Array[Int]): Array[Int] = { | |
(x zip y).map((a: (Int, Int)) => a._1 + a._2) | |
} | |
def sum_matrix(x: Array[Array[Int]], y: Array[Array[Int]]): Array[Array[Int]] = { | |
(x zip y).map((a: (Array[Int], Array[Int])) => sum_vector(a._1, a._2)) | |
} |
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
jenkins@ip-172-31-13-221:/home/james$ netcat -U /tmp/manhole-19489 | |
######### ProcessID=19489, ThreadID=139875607566080 ######### | |
File: "/usr/lib/python3.6/threading.py", line 884, in _bootstrap | |
self._bootstrap_inner() | |
File: "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner | |
self.run() | |
File: "/home/jenkins/datawarehouse/env/lib/python3.6/site-packages/manhole/__init__.py", line 234, in run | |
self.connection_handler(self.client) | |
File: "/home/jenkins/datawarehouse/env/lib/python3.6/site-packages/manhole/__init__.py", line 302, in handle_connection_repl |
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
postgres_1 | ERROR: relation "organizations" does not exist at character 293 | |
postgres_1 | STATEMENT: SELECT organizations.updated_at AS organizations_updated_at, organizations.created_at AS organizations_created_at, organizations.id AS organizations_id, organizations.name AS organizations_name, organizations.slug AS organizations_slug, organizations.settings AS organizations_settings | |
postgres_1 | FROM organizations | |
postgres_1 | WHERE organizations.slug = 'default' | |
postgres_1 | LIMIT 1 | |
server_1 | [2017-01-26 21:30:43,708] ERROR in app: Exception on /login [GET] | |
server_1 | Traceback (most recent call last): | |
server_1 | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1988, in wsgi_app | |
server_1 | response = self.full_dispatch_request() | |
server_1 | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1641, in full_dispatch_request |
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
[archie@archie redash]$ sudo docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
be4ee11ece36 mariadb "docker-entrypoint.sh" 15 minutes ago Up 15 minutes 0.0.0.0:3306->3306/tcp redash_mysql_1 | |
47dbdab08ecc redis:2.8 "docker-entrypoint.sh" 15 minutes ago Up 15 minutes 6379/tcp redash_redis_1 | |
e13258baa4ef postgres:9.3 "/docker-entrypoint.s" 15 minutes ago Up 15 minutes 5432/tcp redash_postgres_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
redash: | |
image: redash/redash:latest | |
ports: | |
- "5000:5000" | |
links: | |
- redis | |
- postgres | |
environment: | |
REDASH_LOG_LEVEL: "INFO" | |
REDASH_REDIS_URL: "redis://redis:6379/0" |