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
a = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,1] | |
#a = list(map(int,raw_input().split(','))) | |
b = a[:] | |
def eq(a,n,mid,res): | |
res = res or [] | |
s = sum(a) | |
if(s%2 != 0 and not mid): | |
return -1 | |
mid = mid or s/2 |
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
import math | |
dots = [[2,2],[9,7],[1,1],[5,5],[2,3]] | |
#расчет расстояния между двумя точками | |
def dst(a, b): | |
return math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2) | |
#поиск всех соседей для заданной точки, ее радиус и кол-во соседей | |
def srch(dot): |
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 tens(a, t, r = []){ | |
if (t < 0) return | |
for(let i of a){ | |
if(i == t) r.push([i]) | |
let s = tens(a.slice(a.indexOf(i) + 1), t - i) | |
if(s) for(let x of s) r.push([i].concat(x)) | |
} | |
return r | |
} |
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
const INFLUX = 590 | |
const TOTAL = 730 | |
const DELTA = TOTAL - INFLUX | |
const arr = [ | |
[630,470,590,-550,-610], | |
[370,380,420,-330,-460], | |
[290,310,160,-240,-360], | |
[150,90,160,-60,-160], | |
[20,60,10,-20,-30] | |
] |
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
import System.Environment | |
influx = 590 | |
total = 730 | |
delta = total - influx | |
x = [[630,470,590,-550,-610], | |
[370,380,420,-330,-460], | |
[290,310,160,-240,-360], | |
[150,90,160,-60,-160], |
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 q(a){ | |
if(a.length <= 1) return a | |
let p = a.shift() //or pop | |
let left = a.filter(e => e <= p) // or in one interation | |
let right = a.filter(e => e > p) | |
return [...q(left), p, ...q(right)] | |
} | |
console.log(q([2,6,7,1,4,9,3,5])) |
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
const log = (...args) => console.log.apply(null, args) | |
const cons = (x, y) => f => f(x,y) | |
const car = x => x((a, _) => a) | |
const cdr = x => x((_, b) => b) | |
const add = (list, el) => cons(el, list) | |
const inc = (x, y) => y(x) | |
const make = (list, from, to, step) => | |
from <= to ? make(add(list, from), inc(from, step), to, step) : list | |
const each = (list, f) => { | |
f(car(list)) |
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
brew install postgres | |
createdb `whoami` | |
psql -U postgres | |
(pg_restore | psql) -U postgres -d xx < xx.dump | |
dokku postgres:export brain > brain_dump.sql | |
scp root@server.com:brain_dump.sql ~/Downloads | |
pg_restore -U postgres -d brain < brain_dump.sql |
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
brew update/cleanup | |
brew install mariadb | |
mysql -uroot | |
create database xx; | |
ctrl+c | |
mysql -uroot xx < xx.sql | |
update user set password=PASSWORD("pass") where User='root'; | |
brew service restart mariadb |
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
// Place your settings in this file to overwrite the default settings | |
{ | |
"window.reopenFolders": "all", | |
"window.newWindowDimensions": "maximized", | |
"workbench.editor.enablePreview": false, | |
"workbench.editor.enablePreviewFromQuickOpen": false, | |
"workbench.iconTheme": "vs-seti", | |
"workbench.welcome.enabled": false, | |
"git.enabled": false, | |
"extensions.autoUpdate": true, |
OlderNewer