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
(ns dojo.core | |
(use clojure.string)) | |
(def *input* | |
" _ _ _ _ _ _ _ | |
| _| _||_||_ |_ ||_||_| | |
||_ _| | _||_| ||_| _|") | |
(def *zeros* | |
" _ _ _ _ _ _ _ _ _ |
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
;; Almost a full solution to KataBankOCR | |
;; taken from http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR | |
(ns dojo.core | |
(:require | |
[clojure.string :as str] | |
[clojure.set :as set])) | |
;; User Story 1 | |
(def *dic* |
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
(ns coins.core) | |
;;; Solution I | |
;;; recursive, with coin hash as a parameter | |
(defn make-coins-rec [coins amount h] ;; all possible solutions in a nested list | |
"return all valid solutions" | |
(cond | |
(zero? amount) h | |
(pos? amount) (map #(make-coins-rec coins (- amount %) (update-in h [%] inc)) coins))) |
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
(ns hello.core) | |
(defn foo | |
"I don't do a whole lot." | |
[x] | |
(println x "Hello, World!")) | |
(defn -main [] | |
(foo "Yes, ")) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>tab title</title> | |
</head> | |
<body> | |
<h2 class="header">header</h2> | |
<div class="container"> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Clojure example!</title> | |
</head> | |
<body> | |
<h2 class="header"> Shouts </h2> | |
<div class="container"> |
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
(use 'ring.util.response | |
'ring.adapter.jetty) | |
;;;;; handler | |
(defn hello-handler [req] | |
(-> | |
(response "Hello") | |
(content-type "text/html"))) |
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
;; play around with a trivial trace transducer | |
;; base on https://gist.github.com/ptaoussanis/e537bd8ffdc943bbbce7#file-transducers-clj | |
(defn trace-tran | |
"print the new input on any iteration. | |
Combine with other transducers for tracing" | |
[reducing-fn] | |
(fn new-reducing-fn | |
([] (reducing-fn)) | |
([accumulation] (reducing-fn accumulation)) |
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
### DML ### | |
# Keyspace Name | |
keyspace: kairos | |
# The CQL for creating a keyspace (optional if it already exists) | |
keyspace_definition: | | |
CREATE KEYSPACE kairos WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 2}; | |
# Table name |
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
#!/usr/bin/env python | |
# prerequisites | |
# sudo pip install pyopenssl ndg-httpsclient pyasn1 gitpython --upgrade | |
# | |
# Usage: ./backup-repos.py user | |
# | |
import requests |
OlderNewer