Skip to content

Instantly share code, notes, and snippets.

View iarenaza's full-sized avatar

Iñaki Arenaza iarenaza

View GitHub Profile
diff --git a/auth/db/auth.php b/auth/db/auth.php
index bb9ed70363d..a1026c466d2 100644
--- a/auth/db/auth.php
+++ b/auth/db/auth.php
@@ -85,7 +85,7 @@ class auth_plugin_db extends auth_plugin_base {
$rs = $authdb->Execute("SELECT *
FROM {$this->config->table}
- WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'");
+ WHERE LOWER({$this->config->fielduser}) = '".$this->ext_addslashes($extusername)."'");
@iarenaza
iarenaza / clojure-learning-list.md
Created December 4, 2022 14:33 — forked from ssrihari/clojure-learning-list.md
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
#!/usr/bin/env bb
;; lein2deps | jet --pretty > deps.edn
(require '[clojure.string :as str]
'[clojure.edn :as edn])
(defn read-project-clj []
(-> "project.clj"
slurp
@iarenaza
iarenaza / rich-already-answered-that.md
Created April 15, 2022 14:37 — forked from reborg/rich-already-answered-that.md
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@iarenaza
iarenaza / lein-check-staged-cljx-files.sh
Created June 7, 2021 13:45
lein-check-staged-cljx-files.sh
#!/usr/bin/env bash
set -eu -o pipefail
echo "Running pre-commit hook, it may take a while..."
# Pre-commit scripts are run from the root directory of the git
# repository. In our case, Leiningen project root is actually in this
# subdirectory inside the git repository root directory.
LEIN_PROJECT_ROOT="app"
@iarenaza
iarenaza / config.edn
Created June 4, 2021 19:57
Using two database connections (with separate db connection pools) with Duct.
{:duct.profile/base
{:duct.core/project-ns project-ns
[:duct.database.sql/hikaricp :duct.database.sql.hikaricp/postgres]
{:jdbc-url #duct/env ["JDBC_POSTGRES_URL" Str]
:minimum-idle 10
:maximum-pool-size 25
;; Other HikariCP options go here.
}
@iarenaza
iarenaza / gist:0cd871419a71b24a21c11b1a3ddddf36
Created April 13, 2021 14:43 — forked from brucecrevensten/gist:a16a554ee1c64d9ac475a1468e94f508
Configuring Leaflet, GeoServer, GeoWebCache with custom projection

Properly configuring GeoServer / GeoWebCache with Leaflet and custom projections (Proj4Leaflet)

These instructions demonstrate the process for EPSG:3572.

Set up a Gridset for the appropriate projection.

Geoserver Admin > Tile Caching > Gridsets > New Set Name / Projection to EPSG:3572, when you tab out of the Projection box it should autocomplete a bit of information here, such as Units, Meters per Unit.

Under “Gridset Bounds,” > Compute from maximum extent of CRS. We’ll need these numbers to configure Leaflet. (An error at the top may show, “Field ‘Gridset Bounds’ is required,” ignore that).

diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php
index f03372f3154..3dc9b7258ba 100644
--- a/auth/ldap/auth.php
+++ b/auth/ldap/auth.php
@@ -468,6 +468,16 @@ class auth_plugin_ldap extends auth_plugin_base {
print_error('auth_ldap_ad_create_req', 'auth_ldap');
}
+ // Add the user to the default group (if configured)
+ if (!empty($this->config->create_default_group)) {
@iarenaza
iarenaza / flat-seq-to-tree-structure.clj
Created March 23, 2020 09:28
flat-seq-to-tree-structure.clj
user> (defn build-hierarchy [flat-list current-root]
(let [{:keys [direct-children others]} (reduce-kv (fn [m k v]
(if (= (:parent-id v) (:id current-root))
(update m :direct-children conj v)
(update m :others conj v)))
(sorted-map)
(vec flat-list))]
(if (seq direct-children)
(let [children (map (fn [direct-child]
(build-hierarchy others direct-child))
@iarenaza
iarenaza / lein-cljfmt-check-staged-cljx-files.sh
Last active October 23, 2019 08:09
Run "lein cljfmt check" on .clj/.cljs/.cljc files staged for commit
#!/usr/bin/env bash
set -eu -o pipefail
staged_files=$(mktemp)
file_mappings=$(mktemp)
temporary_files=$(mktemp)
cljx_files=$(mktemp)
# Prepare clean up for normal or abnormal termination of the script