This file contains hidden or 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
# use passlib (https://passlib.readthedocs.io/en/stable/index.html) which includes a recent implementation of phpass, | |
# the lib Wordpress uses | |
from passlib.hash import phpass | |
# 'password' hashed with a random 8 character salt for a number of rounds=13. Salt and rounds are encoded in the hash itself | |
# https://passlib.readthedocs.io/en/stable/lib/passlib.hash.phpass.html#format | |
# $P${rounds,6-bit integer encoded as char}{salt, 8 characters}{checksum} | |
wordpress_hashed_password='$P$BcT47uPjTpAPe6VtS8MeR4MECevpNb.' | |
# will return True, because it takes it's configuration salt + rounds from the hash above |
This file contains hidden or 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
// The core of this is using a single broker for event handling across the app in RiotControl._broker. | |
// Then all events are handled by riot.control.on and triggered by riot.control.trigger. | |
// Special handling is required in riot tags to ensure that events get mounted/unmounted along with the tag, | |
// else you end up with fns firing in the background | |
// ===================================== | |
// event_helper.js | |
class RiotControl { | |
constructor() { |
This file contains hidden or 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
package com.vaughndickson.elasticsearch | |
import groovy.util.logging.Slf4j | |
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus | |
import org.elasticsearch.client.Client | |
import org.elasticsearch.client.transport.TransportClient | |
import org.elasticsearch.common.settings.ImmutableSettings | |
import org.elasticsearch.common.settings.Settings | |
import org.elasticsearch.common.transport.InetSocketTransportAddress | |
import org.springframework.beans.factory.DisposableBean |
This file contains hidden or 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
;; Schema | |
{:db/doc "Find or create tag atomically." | |
:db/ident :find-or-create-tag | |
:db/fn #db/fn {:lang "clojure" | |
:params [mydb n key value] | |
:code (when (empty? (d/q '[:find ?e :in $ ?ns ?key ?value :where | |
[?e :meta/tag-namespace ?n] | |
[?e :meta/tag-key ?key] | |
[?e :meta/tag-value ?value]] |
This file contains hidden or 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 scratchpad.core | |
(:require [clojure.pprint :as pprint])) | |
(defn get-dataset | |
[file] | |
(with-open [rdr (clojure.java.io/reader file)] | |
(vec (line-seq rdr)))) | |
(defn str-len-distance | |
;; normalized multiplier 0-1 |
This file contains hidden or 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 search-index | |
(:require [clucy.core :as clucy] | |
[clojure.core.cache :as cache])) | |
(def my-data [{:name "bob" :age 32 } | |
{:name "Susan" :age 24}]) | |
;; refresh cache every minute | |
(def cache (atom (cache/ttl-cache-factory {} :ttl (* 60 1000)))) |
This file contains hidden or 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 | |
# kill all subshells and processes on exit | |
trap "kill 0" SIGINT | |
# start commands in subshells so all their spawn DIE when we exit | |
( process1 ) & | |
( process2 ) & | |
wait |
This file contains hidden or 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
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://user-groups3") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact | |
conn | |
[{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] | |
:db/ident :user/name |
This file contains hidden or 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
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://user-groups2") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact | |
conn | |
[{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] | |
:db/ident :user/name |