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 get-slots [t0 t1 limit] | |
(try | |
(mq/with-collection (dbc) ENROLLS_COLL | |
(mq/find {:at {:$gte t0 :$lt t1} :state 0}) | |
(mq/limit limit)) | |
(catch Exception e | |
(warn e)))) | |
; |
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 stg.fb.webhook | |
(:import | |
[javax.crypto Mac] | |
[javax.crypto.spec SecretKeySpec]) | |
(:require | |
[clojure.string :as s] | |
[cheshire.core :as json] | |
[taoensso.timbre :refer [debug info warn]] | |
[ring.adapter.jetty :refer [run-jetty]] |
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
use admin | |
db.createUser({user:'root',pwd:'ADMPASS',roles:['root']}) | |
mongo -u root -p ADMPASS localhost/admin | |
use MYDB | |
db.createUser({user:'MYUSER',pwd:'MYPASS',roles:['readWrite']}) | |
mongo -u MYUSER -p MYPASS localhost/MYDB |
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
function parse_qs() | |
{ | |
var parsedParameters = {}; | |
var qs = location.search.substr(1); | |
var uriParameters = qs.split('&'); | |
for (var i = 0; i < uriParameters.length; i++) | |
{ | |
var p = uriParameters[i].split('='); | |
parsedParameters[p[0]] = decodeURIComponent(p[1]); |
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 validate-first_name [params] | |
(if-let [nm (-> params :first_name str s/trim norm-first_name)] | |
{:first_name nm} | |
{::err "wrong first_name" :fld :first_name})) | |
; | |
(defn validate-last_name [params] | |
(if-let [nm (-> params :last_name str s/trim norm-last_name)] | |
{:last_name nm} | |
{::err "wrong last_name" :fld :last_name})) |
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
commentArea.addEventListener('keydown', autosize); | |
function autosize () { | |
var el = this; | |
setTimeout(function () { | |
el.style.cssText = 'height:auto;'; | |
el.style.cssText = 'height:' + el.scrollHeight + 'px'; | |
}, 0); | |
} |
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 courses [state evt] | |
(let [scns scn/scn-data] | |
{ :state (assoc state :wait nil) | |
:frames | |
[ | |
{:attachment | |
{ :type "template" | |
:payload | |
{ :template_type "generic" | |
:elements |
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 autourl-transformer [text state] | |
[(if (:code state) | |
text | |
(string/replace | |
text | |
#"<https?://[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]>" | |
#(let [url (subs % 1 (dec (count %)))] | |
(str "<a href=\"" url "\">" url "</a>")))) | |
state]) | |
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
echo 100 > "/sys/module/ipmi_si/parameters/kipmid_max_busy_us" |
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
Y = 0.21*R + 0.72*G + 0.07*B > 80% for light background | |
https://events.yandex.ru/lib/talks/2491/ | |
(7:38) |