This file contains hidden or 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
// | |
// knn.h | |
// k_nearest_neighbor | |
// | |
// http://burakkanber.com/blog/machine-learning-in-js-k-nearest-neighbor-part-1/ | |
// | |
// Created by Garrett Thornburg on 8/1/14. | |
// Copyright (c) 2014 gt. All rights reserved. | |
// |
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
#include <list> | |
template<typename T, typename V> | |
T map(T list, std::function<V (V)> fn) { | |
T new_list; | |
for(V& value : list) { | |
new_list.push_back( fn(value) ); | |
} |
This file contains hidden or 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
(ns rain-topology) | |
;; An Interview Question from Jane Street: | |
;; Given some topology, assume it rained and settled, | |
;; return a new array of the collected rain fall. | |
;; _ | |
;; _| | _ | |
;; _| | _| | | |
;; | |_| | | |
;; |
This file contains hidden or 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
(ns euler.euler-11 | |
(:require [clojure.string :as s])) | |
(def grid-data | |
"Open data from file" | |
(slurp "files/11.txt")) | |
(defn- get-grid | |
"Get the matrix from the slurped text. Break on new lines, then split and parse for Ints" | |
[] |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace WindowsFormsApplication1 { | |
class SimplexSolver { | |
private int[] N; // Indicies of non-basic variables |
This file contains hidden or 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
;; | |
;; Checkout this page for large prime numbers: http://primes.utm.edu/lists/small/small3.html | |
;; | |
;; Testing a 300 digit prime number | |
(def some-large-prime 290245329165570025116016487217740287508837913295571609463914348778319654489118435855243301969001872061575755804802874062021927719647357060447135321577028929269578574760547268310055056867386875959045119093967972205124270441648450825188877095173754196346551952542599226295413057787340278528252358809329N) | |
(is-prime? some-large-prime) ;;=> true || Elapsed time: 216.512 msecs | |
;; Testing a long even number | |
(def some-long-even-number 709127341927349283740927349823749237492734092873492842N) |
This file contains hidden or 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
val cipher = Map('a' -> 'а', 'b' -> 'б', 'c' -> 'ц', 'd' -> 'д', 'e' -> 'е', 'f' -> 'ф', 'g' -> 'г', | |
'h' -> 'ч', 'i' -> 'и', 'j' -> 'й', 'k' -> 'к', 'l' -> 'л', 'm' -> 'м', 'n' -> 'н', | |
'o' -> 'о', 'p' -> 'п', 'q' -> 'я', 'r' -> 'р', 's' -> 'с', 't' -> 'т', 'u' -> 'у', | |
'v' -> 'в', 'w' -> 'ш', 'x' -> 'х', 'y' -> 'ы', 'z' -> 'з', ' ' -> '@') | |
lazy val reverse_cipher = cipher.map(_.swap) | |
def encrypt(word: String) = | |
word.flatMap(x => cipher(x.toLower).toString) | |
This file contains hidden or 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
(defn power-of [x n] | |
(loop [i 0, acc 1] | |
(if (not (< i n)) | |
acc | |
(recur (inc i) (* acc x))))) | |
(def thousand (range 1 1001)) | |
(def big-thousand (map #(power-of (bigint %1) 5) hundred)) | |
(print (reduce * big-thousand)) |
This file contains hidden or 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
package servertester.modules; | |
import java.io.*; | |
import java.net.HttpURLConnection; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: film42 |
This file contains hidden or 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
public class Counter { | |
private int[] seq = null; | |
public Counter(int size) { | |
this.seq = new int[size]; | |
} | |
public Counter() { | |
this.seq = new int[10]; |