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
;;; -*- lexical-binding: t -*- | |
;; Package system and sources. | |
(require 'package) | |
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) | |
(not (gnutls-available-p)))) | |
(proto (if no-ssl "http" "https"))) | |
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired | |
;; (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) | |
(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) |
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
type Image = int [] | |
type Sample = { Label:int; Pixels:Image } | |
let csvToRecords (lines:string[]) = | |
lines.[1..] | |
|> Array.Parallel.map (fun x -> x.Split(',')) | |
|> Array.Parallel.map (Array.map int) | |
|> Array.Parallel.map (fun x -> {Label = x.[0]; Pixels = x.[1..]}) | |
let distance (sample1:Image) (sample2:Image) = |
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
let toOctalString (x: int) = System.Convert.ToString(x, 8) | |
let toDecimalString (x: int) = System.Convert.ToString(x, 10) | |
let stringReverse (s: string) = | |
System.String(Array.rev (s.ToCharArray())) | |
let isPalindrome x = | |
x = stringReverse x | |
let candidates = seq { 1 .. 1000000 } |
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
;; Don't need buttons in emacs! By running this early we avoid a flash | |
;; of buttons before they are removed. | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(setq use-dialog-box nil) | |
;; BORING: Ensure everything is UTF-8 all the time | |
(prefer-coding-system 'utf-8) | |
(setq locale-coding-system 'utf-8) |
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
var fs = require('fs'); | |
var http = require('http'); | |
var ports = require('seaport').connect('localhost', 5001); | |
try { | |
// Type-coerce file contents to a Number | |
var counter = +fs.readFileSync('count.db', 'utf8'); | |
} catch(e) { | |
// If the file doesn't exist create it | |
var counter = 0; |