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
#!/usr/bin/env python | |
# prerequisites | |
# sudo pip install pyopenssl ndg-httpsclient pyasn1 gitpython --upgrade | |
# | |
# Usage: ./backup-repos.py user | |
# | |
import requests |
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
console.log('Loading function'); | |
var aws = require('aws-sdk'); | |
var region = 'us-west-2'; | |
var ec2 = new aws.EC2({region: region}); | |
var topicArn = "arn:aws:sns:us-west-2:797456418907:cloudius_running_ec2_instances"; | |
function push(payload, context) { | |
var sns = new aws.SNS(); |
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
# Even Fibonacci numbers | |
# https://projecteuler.net/problem=2 | |
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: | |
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
# By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. | |
(defn fib | |
([] (fib 1)) | |
([a] (fib 1 a)) |
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"> |
OlderNewer