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
(defn -main[& args] | |
(if-let [_ args] | |
(println "with args") | |
(println "without args"))) | |
; $ lein run | |
; without args | |
; $ lein run meh | |
; with args |
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 logic.core | |
(use [clojure.math.combinatorics])) | |
(defn solve-logic-puzzle-1 [] | |
"http://rachacuca.com.br/logica/problemas/1/" | |
(let [people [:espanhol :alemao :italiano]] | |
(first | |
(for [[casa1 casa2 casa3] (permutations people) ; casas | |
[azul vermelha preta] (permutations people) ; cores | |
; O Espanhol mora diretamente à direita do homem que mora na casa vermelha. |
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
import java.sql.*; | |
public class SqliteSample { | |
private Connection conn; | |
private boolean inserting; | |
public void openDB() throws ClassNotFoundException { | |
Class.forName("org.sqlite.JDBC"); | |
try { |
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
digraph repl { | |
LER -> EXECUTAR -> IMPRIMIR -> LER | |
} |
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
; Qual o valor mostrado na tela? 10, 20, 30 ou nem compila? | |
(def m 10) | |
(defn foo [m] | |
(def m 20) | |
(println m)) | |
(foo 30) |
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
#!/bin/bash | |
# SCRIPT: method1.sh | |
# PURPOSE: Process a file line by line with PIPED while-read loop. | |
FILENAME=$1 | |
count=0 | |
cat $FILENAME | while read LINE | |
do | |
ufw deny from $LINE | |
done |
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
;;; base64.clj: Experimental Base-64 encoding and (later) decoding | |
;; by Stuart Sierra, http://stuartsierra.com/ | |
;; August 19, 2009 | |
;; Copyright (c) Stuart Sierra, 2009. All rights reserved. The use | |
;; and distribution terms for this software are covered by the Eclipse | |
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
;; which can be found in the file epl-v10.html at the root of this | |
;; distribution. By using this software in any fashion, you are |
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
; first I received this, and its result is 5. why? | |
((fn [[?<& %*+ $*|]](?<& %*+ $*|))({['*$] [+ (+ (*) (*)) (* 3 (*))]} ['*$])) | |
; so I formatted the code | |
((fn [[?<& %*+ $*|]] | |
(?<& %*+ $*|)) | |
({['*$] [+ (+ (*) (*)) (* 3 (*))]} ['*$])) | |
; ?<& is the first parameter, %*+ is the second and $*| is the last. let's rename to x, y and z |
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
Inicio | |
+---------+---------+---------+ | |
| 6 | 3 | 8 4 | | |
| | | | | |
| 5 3 7 | 9 | | | |
| | | | | |
| 4 | 6 | 3 7 | | |
+---------+---------+---------+ | |
| 9 | 5 1 | 2 3 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
(group-by even? (range 1 11)) | |
; {false [1 3 5 7 9], true [2 4 6 8 10]} | |
(group-by #(= (mod % 3) 0) (range 1 15)) | |
; {false [1 2 4 5 7 8 10 11 13 14], true [3 6 9 12]} | |
(group-by #(mod % 3) (range 1 15)) | |
; {1 [1 4 7 10 13], 2 [2 5 8 11 14], 0 [3 6 9 12]} |