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
(require '[clojure.data.csv :as csv] | |
'[clojure.tools.cli :refer [parse-opts]]) | |
(def cli-options | |
;; An option with a required argument | |
[["-f" "--file FILE" "File path" | |
; :default 80 | |
; :parse-fn #(Integer/parseInt %) | |
:validate [string? "Must be a string"]] | |
["-h" "--help"]]) |
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
wget --recursive --no-clobber --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains "proekt.media,proektmedia-stat.ams3.digitaloceanspaces.com" --mirror -U "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" www.proekt.media |
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- -l [host port path] | |
{:post [(= 0 (:exit %))]} | |
(->> (sh "ssh" (str user "@" host) | |
"-p" port | |
"cd" path | |
"&&" | |
"ls -l"))) | |
(defn l-humanize [user host port path] |
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 write-csv [writer row-data] | |
(let [columns (->> | |
row-data | |
first | |
(into (sorted-map)) | |
keys) | |
headers (map name columns) | |
rows (->> row-data | |
(map (comp vals #(into (sorted-map) %))))] | |
(csv/write-csv writer (lazy-seq (cons headers rows))))) |
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 csv-data->maps [csv-data] | |
(map zipmap | |
(->> (first csv-data) ;; First row is the header | |
(map keyword) ;; Drop if you want string keys instead | |
repeat) | |
(rest csv-data))) | |
(defn transpose [m] |
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 nil-response->bad-request-response [handler] | |
(fn [& args] | |
(let [resp (apply handler args)] | |
(if (some? resp) | |
resp | |
responses/bad-request)))) |
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
for i in $(docker images -a | grep '<none>' | awk '{print $3}');do docker rmi -f $i;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
# cd /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/lib/security | |
cd /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/security | |
keytool -importcert -alias amber -keystore cacerts -file ~/c.cer -trustcacerts -storepass changeit |
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
site uri | |
(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}) |
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
log4j.rootLogger=INFO, console | |
log4j.appender.console=org.apache.log4j.ConsoleAppender | |
log4j.appender.console.layout=org.apache.log4j.PatternLayout | |
log4j.appender.console.layout.ConversionPattern=%d %-5p - %m%n |
NewerOlder