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 query-node-with-path | |
([[ s & _ :as source ] | |
{type :type children :children wf :word-fragment :as node} | |
acc] | |
(prn "source " source) | |
(prn "s " s) | |
(prn "type " type) | |
(prn "node " node) | |
(prn "acc " acc))) |
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 sgs.core | |
(:require [instaparse.core :as p] | |
[clojure.pprint :refer (pprint)])) | |
;; http://stackoverflow.com/questions/20654883/whats-an-elegant-way-to-parse-this-data-format-in-clojure | |
(def sgs | |
(p/parser | |
" | |
<SGS> = (<COMMENT_ROW> | ROW)+ |
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
["YIIzO", "turcUUfN", "EhSethGlS", "p_fhwdsts", "C", "HRoz", "_QXH", "EFDMpgc", "N", "DbKdomnTiu", "CVtLGKsP", "MAZx", "rlLuMB", "qipauyMRkp", "t", "RV", "uIldIkV", "lKaYnIeWs", "_FKzuYmBMo", "SVlI", "vXwgdmxF", "UI", "bC lZ", "D", "zVHGWTtBD", "WQcf", "JzEAJ", "BLItG", "fvPqgfonB", "Uz_", "G", "w", "k", "qkbIEgNrQ", "pY", "CX", "OGw_", "TRJds", "vXLGltC_q", "KNnvml", "Se ED"] | |
{:vlazit=>["YIIzO", "turcUUfN"], :ne_vlazit=>["EhSethGlS", "p_fhwdsts", "C", "HRoz", "_QXH", "EFDMpgc", "N", "DbKdomnTiu", "CVtLGKsP", "MAZx", "rlLuMB", "qipauyMRkp", "t", "RV", "uIldIkV", "lKaYnIeWs", "_FKzuYmBMo", "SVlI", "vXwgdmxF", "UI", "bC lZ", "D", "zVHGWTtBD", "WQcf", "JzEAJ", "BLItG", "fvPqgfonB", "Uz_", "G", "w", "k", "qkbIEgNrQ", "pY", "CX", "OGw_", "TRJds", "vXLGltC_q", "KNnvml", "Se ED"], :length=>215} |
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 snakeyaml-example.core | |
(:require [clojure.string :refer (split)]) | |
(:import [org.yaml.snakeyaml.constructor SafeConstructor | |
AbstractConstruct Construct] | |
[org.yaml.snakeyaml.nodes Tag Node ScalarNode NodeId] | |
[snakeyaml-example.core Dice ConstructDice DiceConstructor])) | |
(set! *warn-on-reflection* true) | |
(gen-class |
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 platezhki.core | |
(:require [goog.events :as ev] | |
[goog.dom :as dom]) | |
(:use-macros [platezhki.macros :only (inside)])) | |
;; Electricity | |
(defn log [& args] | |
(.log js/console args)) | |
(inside ".electro" (log "OK") |
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 'ipaddr' | |
def by_exception ip | |
begin | |
IPAddr.new(ip, Socket::AF_INET) | |
true | |
rescue ArgumentError | |
false | |
end | |
end |
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/python | |
import numpy as np | |
import talib | |
open, high, low, close = [......] # same arrays | |
cdl = talib.CDL3INSIDE(np.array(open), np.array(high), np.array(low), np.array(close)) | |
print cdl |
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 'thread/pool' | |
class ChartExport | |
def self._threads_test | |
a = Queue.new | |
1000.times { | |
pool = Thread.pool(10) | |
100.times { | |
pool.process { a << 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
; Global settings | |
[redshift] | |
temp-day=6500K | |
temp-night=4500K | |
transition=1 | |
gamma=0.8:0.7:0.8 | |
;gamma=1.000:1.000:1.000 | |
;location-provider=geoclue | |
location-provider=manual | |
adjustment-method=vidmode |
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 'pp' | |
h = [1, 2, 3, 1, 2, 3, 2, 1, 3, 2, 1] | |
opened = [] | |
r = h.inject("") do |a, x| | |
# close tags if needed | |
while opened.last != nil && opened.last >= x | |
a << "</h#{opened.pop}>" |