Skip to content

Instantly share code, notes, and snippets.

View dividead's full-sized avatar
🧐

Daniil Pletnev dividead

🧐
View GitHub Profile
@dividead
dividead / hh2.py
Last active December 28, 2016 08:20
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
@dividead
dividead / hh1.py
Last active December 28, 2016 08:20
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):
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
}
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]
]
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],
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]))
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))
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
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
// 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,