Skip to content

Instantly share code, notes, and snippets.

(def input "xyzzy | yzzy
afbbbfjdjklgdfdhfdkjfffhhfffjkdfhdhkyejejfjkd | dhfdkjfffhhfffjkdfhd
bartarcarracecarbartar | racecar
3.1415926535897932384626433832795028841971 | 46264")
(defn polindrome? [x]
(= (reverse s) (seq s)))
(defn splt [s]
(clojure.string/split s #"\n| | "))
@dosbol
dosbol / combinations.cljs
Created January 26, 2017 07:01
[Draft]Returns all possible combinations from input
(defn appendV [i v] (for [row [i] column v] (str row column)))
(appendV 5 [5 4 7])
("55" "54" "57")
(loop [s1 ["1"] s2 [1 2 3] i 0]
(if (= (count s2) (count (nth s1 i)) ) s1 (recur (conj s1 (appendV (nth s1 i) s2)) s2 (inc i) ) ) )
["1" ("11" "12" "13")]
(conj ["1"] ["11" "12"])
@dosbol
dosbol / json
Created January 19, 2018 11:05
Administrative_boundaries
{"type":"Topology","arcs":[[[35855,14043],[-122,-11],[-187,-36],[-237,-37],[-75,10],[-349,92],[-387,61],[-71,-280],[-70,-360],[-39,-29],[-147,63],[-166,42],[-187,14],[-188,-107],[-170,-143],[-244,32],[-981,235],[-495,128],[-240,-106],[-224,-56],[-286,52],[-222,36],[-194,65],[-282,86],[-184,67],[-24,-35]],[[30084,13826],[-186,27],[-208,-45],[-129,-63],[-126,-73],[-200,10],[-223,-63],[-215,-114],[-161,-81],[-186,-79],[-140,-46],[-137,-62],[-86,23],[7,243],[-93,104],[-72,164],[-49,138],[-307,-109],[-431,-119],[-30,-206],[-16,-76],[-346,-177],[-408,-176],[-282,-129],[-131,-62],[93,-337],[53,-213],[110,-229],[-205,-146],[-269,-141],[-140,-141],[-115,-106],[-204,-135],[-225,-154],[-207,-125],[-223,-50],[-156,51],[-140,-15],[-123,-34],[-358,-195],[-193,-130],[-130,-86]],[[23497,10669],[-11,51],[-2,10],[-4,198]],[[23480,10928],[4,268],[3,15],[34,203],[1,1],[50,245]],[[23572,11660],[4,11]],[[23576,11671],[25,80],[1,3],[5,16],[21,66],[112,266],[145,272],[21,60],[167,329],[93,315],[38,247],[107,358],[66,309],[68,394],[2
@dosbol
dosbol / json
Created January 20, 2018 07:03
Administrative_bound
{"type":"Topology","arcs":[[[13843,18812],[17,-4],[299,-235],[478,-140],[204,-30],[82,-36],[682,-359],[24,5],[47,35],[18,0],[17,-2],[33,-14],[15,-8],[13,-8],[47,-5],[39,11],[50,8],[59,0],[177,-50]],[[16144,17980],[424,-111],[493,-213],[890,-212],[1638,-749]],[[19589,16695],[660,-99],[768,-659],[590,-302],[117,-93],[372,-12],[644,-127],[365,-8],[128,17],[1156,-71],[951,-16],[744,56],[782,-117],[5,-20],[7,-8],[15,-4],[14,3],[10,5],[11,-1],[6,-3],[-1,-39],[-24,-26],[-4,-21],[-18,-28],[18,-41],[26,-34],[-5,-17],[12,-26],[-1,-15],[-10,-17],[0,-14],[17,-16],[8,-23],[47,-13],[5,-11],[8,-4],[3,-21],[-12,-11],[-38,-11],[-4,-4],[-3,-14],[-14,-16],[1,-14],[8,-8],[10,-2],[8,-15],[-4,-6],[10,-9],[-1,-30],[12,-14],[-1,-9],[3,-13],[-25,-25],[40,-79],[-54,-75],[40,-86],[95,-74],[124,-66],[-13,-52],[47,-41],[51,-38],[14,-41],[23,-36],[16,7],[40,13],[30,-13],[35,-59],[13,-53],[-5,-20],[28,-21],[2,-31],[22,-17],[51,-20],[27,-73],[30,-71],[-13,-20],[-64,-41],[-26,-64],[5,-37],[-56,-77],[-84,-41],[-15,-48],[-11,-37],[42,-32],[-30
@dosbol
dosbol / arrays.txt
Last active January 25, 2018 12:10
datatables
{
"data": [
["System Architect", "Edinburgh", "5421", "2011/04/25", "$320,800"],
["Accountant", "Tokyo", "8422", "2011/07/25", "$170,750"]
]
}
@dosbol
dosbol / clojure-programming-blog.md
Created July 5, 2018 05:52 — forked from zelark/clojure-programming-blog.md
#clojure #clojurescript #blog #grumpy.website

Clojure Programming: Blog

  • Part 1: Начало статического блога. Immutant, Ring, Compojure, HTML rendering через Rum
  • Part 2: Forms, middlewares, redirects, 404 and error handling
  • Part 3: id generator, loops, cookies, sessions, authorization, working w/ files, macros
  • Part 4: Cookies, рефакторинг, неймспейсы, RSS фид
  • Part 5: Infinite Scroll на JS, sitemap.xml, robots.txt
  • Part 6: Настраиваем CLJS окружение
  • Part 7: Переделываем форму редактирования на Rum, клиент+сервер-сайд рендеринг, EDN-сериализация данных
  • Part 8: CLJS, drag-n-drop upload, browser API, Rum mixins, local state
@dosbol
dosbol / botva
Created July 10, 2018 04:50
draft solution(texting from smartphone)
https://algoprog.ru/material/p50
const iter = (first, second, n) => {
if(isEmpty(first)) return 'second'
if(isEmpty(second)) return 'first'
if(n === 1000000) return 'botva'
const firstCard = head(first)
const secondCard = head(second)
return iter(firstCard < secondCard ? headPoped(first) : tailPushed(first, secondCard, firstCard), firstCard > secondCard ? headPoped(second) : tailPushed(second, firstCard, secondCard), n+1)
rpm -ivh https://yum.postgresql.org/9.6/redhat/rhel-7.3-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96 postgresql96-server postgresql96-libs postgresql96-contrib postgresql96-devel
/usr/pgsql-9.6/bin/postgresql96-setup initdb
vi /var/lib/pgsql/9.6/data/pg_hba.conf
pg_hba.conf excerpt (updated)
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
get .rpm from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
sudo yum localinstall jdk-8u161-linux-x64.rpm
rpm -ivh https://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96 postgresql96-server postgresql96-libs postgresql96-contrib postgresql96-devel
service postgresql-9.6 initdb
vi /var/lib/pgsql/9.6/data/pg_hba.conf
host all all 0.0.0.0/0 md5
host all all ::1/128 md5