Skip to content

Instantly share code, notes, and snippets.

@guilespi
guilespi / README.md
Created July 26, 2022 13:10 — forked from maxious/README.md
Esee/Anran 960P 180° Wireless Fisheye Panoramic CCTV Smart Camera HD WIFI Webcam IP
(defmethod validation/valid-field? :document-MX
[{value :value}]
(let [match (re-find #"(?i)(^[a-z]{2})([a-z])([a-z])(\d{6})(H|M)([a-z]{2})([a-z]{3})(\d{2})$" value)]
match))
(defmethod validation/valid-field? :document-UY
[{value :value}]
(when-let [[_ number digit] (re-find #"^(\d{7})-(\d)$" value)]
(let [m [2 9 8 7 6 3 4]
c (map #(utils/str->int (str %)) number)
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
(defn validate-mappings
"Validates each mapped import is for an
existent field in the specified company"
[fields headers mappings]
(letfn [(found? [list element] (< (.indexOf list element) 0))]
(filter (fn [[header field]]
(or (found? headers header)
(found? fields field)))
mappings)))
@guilespi
guilespi / memo.md
Created April 1, 2014 18:08 — forked from yokolet/memo.md
@guilespi
guilespi / dec2rom.clj
Last active December 31, 2015 19:09
decimal to roman
(def conv-table (sorted-map 1 :I
4 :IV
5 :V
9 :IX
10 :X
40 :XL
50 :L
90 :XC
100 :C
400 :CD
@guilespi
guilespi / parallel-words.clj
Created November 13, 2013 23:27
Split a string into words, parallel implementation using clojure fold
(defn maybe-word
[s]
(if (= "" s) [] [s]))
(defprotocol WordState
(append-chunk [this chunk] "Append a chunk to current word state")
(append-segment [this segment] "Append a segment to current word state")
(to-word-list [this] "Returns the state as a list of words"))
@guilespi
guilespi / mutagenesis.R
Created October 28, 2013 16:40
charting
library(ggplot2)
library(reshape2)
results <- read.csv("/Users/guilespi/Downloads/practico 3 - datos - mutagenesis.csv")
results$NroGrupo <- paste(results$Grupo, ".", results$Subgrupo)
timedMeasures <- melt(results, id.vars = c("Grupo", "Subgrupo", "NroGrupo", "Hongo", "Distancia", "Potencia"), value.name="Colonias", variable.name="Tiempo")
ggplot(timedMeasures, aes(x = Tiempo, y = Colonias, colour = NroGrupo)) + geom_line(aes(group = NroGrupo))
results$sobrevida <- (results$t5 / results$t0) * 100
ggplot(data=results, aes(x=NroGrupo, y=sobrevida, fill=Potencia)) +
@guilespi
guilespi / analisis1.clj
Created July 30, 2013 00:13
el porcentaje de egresados es un bolaso si no contás cuantas veces la gente rinde una materia, estamos hablando de % de aprobación no de egreso
(defn analisis1
[students approval-rate]
(let [total (count students)
expected-approvals (* total approval-rate)]
(loop [examined students iterations 0]
(let [remaining (- total (count examined))]
(if (< remaining expected-approvals)
(let [approved (* (count examined) 0.1)]
(recur (drop (int approved) examined) (inc iterations)))
<?php
//Main script settings
$CALL_ERROR_MSG = "Sorry, but I could not connect your call. Please try again later";
$ALT_CALLER_ID = "";
if (substr($CALLER_ID, 0, 3)=="011") {
$CALLER_ID = "00" . substr($CALLER_ID, 3);
}