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
# Exemplo usando a biblioteca https://pypi.org/project/pyshp/1.1.7/ | |
import shapefile | |
from json import dumps | |
# read the shapefile | |
reader = shapefile.Reader("my.shp") | |
fields = reader.fields[1:] | |
field_names = [field[0] for field in fields] | |
buffer = [] |
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 render | |
(:require [clojure.string :as s] | |
[sicmutils.ratio :as r] | |
[sicmutils.expression.render :refer :all])) | |
(def ->TeX2 | |
"Convert the given (simplified) expression to TeX format, as a string." | |
(let [TeX-accent (fn [accent] | |
(fn [[_ stem]] | |
(str "\\" accent " " (#'sicmutils.expression.render/maybe-brace (->TeX stem))))) |
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 | |
# Add to project/.git/hooks/ w/ +x permission | |
echo "Running pre-commit linter..." | |
files=$(git diff --diff-filter=d --cached --name-only | grep -E '\.(base|clj)$' | tr '\n' ' ' | xargs) | |
lein do cljfmt fix $files, nsorg -e $files | |
if [ $? -ne 0 ]; then |
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
IDE: lsp-mode + clojure-lsp | |
REPL: cider | |
Static analysis: clj-kondo or joker | |
:flutter: | |
IDE: lsp-dart |
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 poc | |
(:gen-class) | |
(:require [clojure.pprint] | |
[clojure.string :as str]) | |
(:import (java.math RoundingMode MathContext) | |
(clojure.lang Ratio PersistentVector IPersistentCollection))) | |
(def ^:dynamic *precision* 10) | |
(def ^:dynamic *scale* 2) | |
(def ^:dynamic *rounding* RoundingMode/HALF_EVEN) |
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
# Download TSV from https://docs.google.com/spreadsheets/d/1HzdumNltTj2SHmCv3SRdoub8SvpIEn75fa4Q23x0keU/edit#gid=793911758 | |
cat Free\ Springer\ Books\ -\ eBook\ list.tsv | | |
tail -n +1 | | |
cut -f 1,8 | | |
tr '\t' '\n' | | |
sed 's/^/"/;s/$/"/' | | |
xargs -n2 sh -c 'echo "url = \"https://link.springer.com/content/pdf/10.1007%2F$2.pdf\"\noutput = \"$1.pdf\""' sh |
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.y | |
(:refer-clojure :exclude [== reify inc]) | |
(:use [clojure.core.logic minikanren prelude | |
nonrel match])) | |
(defna findo [x l o] | |
([_ [[?y :- o] . _] _] | |
(project [x ?y] (== (= x ?y) true))) | |
([_ [_ . ?c] _] (findo x ?c o))) |
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
;;; WEB -- 18 June 2016 | |
;; Type inferencer in miniKanren, adapted from Oleg's Kanren polymorphic type inferencer | |
;; | |
;; http://kanren.cvs.sourceforge.net/viewvc/kanren/kanren/examples/type-inference.scm?view=markup | |
;; | |
;; Unlike the Kanren inferencer, this definition of !- is a pure | |
;; relation, with no cuts and no uses of project. This inferencer | |
;; also does not require a parser/unparser, and allows shadowing. |
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
MARKDOWN = pandoc --standalone --from markdown+smart --to html --css theme.css | |
all: $(patsubst %.md,%.html,$(wildcard *.md)) Makefile | |
clean: | |
rm -fv $(patsubst %.md,%.html,$(wildcard *.md)) | |
publish: | |
aws-3.7 s3 sync . s3:/<BUCKET> --exclude "*" --include "*.html" --include |
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
def coerceDate(dateFormat: String)(dateAsString: String) = { | |
val fmt = new java.text.SimpleDateFormat(dateFormat) | |
val dt = fmt.parse(dateAsString) | |
new java.sql.Date(dt.getYear, dt.getMonth, dt.getDay) | |
} |
NewerOlder