Skip to content

Instantly share code, notes, and snippets.

import math._
import scala.util._
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
object Player extends App {
// w: number of columns.
// h: number of rows.
import math._
import scala.util._
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
object Solution extends App {
val n = readInt
val strengths = (1 to n).map(_ => readInt).sortWith(_ < _)
@mikekwright
mikekwright / chuck_norris.scala
Created June 15, 2018 06:46
Solution for chuck_norris problem from codingame in scala.
// https://www.codingame.com/training/easy/chuck-norris
import math._
import scala.util._
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
object Solution extends App {
val message = readLine
@mikekwright
mikekwright / client.py
Created October 3, 2016 15:31
Sample client I created to validate the client-server hacker-rank problem
#!/usr/bin/env python3
import sys, threading, socket
def read_all_from_connection(connection):
raw_message = []
message = ''
while 1:
data = connection.recv(1024)
if not data or data == '':
@mikekwright
mikekwright / tmux-run-and-edit
Last active December 23, 2015 21:00
This is a sample of a tmux script that can be used to create an environment with a long running command on the left (like a test runner) and on the right vim opened
#!/usr/bin/env bash
# vim: ft=sh
SESSION_NAME=${SESSION_NAME-default}
COMMAND=${COMMAND-''}
show_usage() {
echo -e "Usage: $0 <directory>\n"
echo -e "\tOptions as environment variables"
echo -e "\t\tSESSION_NAME: name of tmux session (allows for reattach)"
echo -e "\t\tCOMMAND: command to run in command window (left pane)"
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@mikekwright
mikekwright / pom.xml
Last active August 29, 2015 14:06 — forked from codahale/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
%% autoload all modules that are in the code:path() and reside in the user directory
%% put in ~/.erlang
[code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
|| P <- lists:filter(fun(Path) -> string:str(Path, os:getenv("USER")) > 0 end, code:get_path()), F <- filelib:wildcard(P ++ "/*.beam")].
@mikekwright
mikekwright / ocaml-install.sh
Created November 16, 2013 22:47
Ocaml 4.01.0 and opam 1.1.0 install helper.
#!/bin/bash
# Sample of this executing located below
#
# INSTALL_PREFIX=$HOME/Development/ocaml CODE_DIR=$HOME/Development/src ./ocaml-install.sh
#
function installOcaml
{
local codeDir=$1
local installDir=$2