Skip to content

Instantly share code, notes, and snippets.

View nLight's full-sized avatar
:shipit:

Dmitriy (Dima) Rozhkov nLight

:shipit:
View GitHub Profile
@nLight
nLight / schema.clj
Last active December 17, 2015 21:49
Решение с мультиметодами и тестами. Запустить тесты можно командой (run-tests 'schema) schema=> (run-tests 'schema) Testing schema Ran 1 tests containing 5 assertions. 0 failures, 0 errors. {:type :summary, :pass 5, :test 1, :error 0, :fail 0}
(ns schema
(:use clojure.test))
(defn- schema-type [schema data]
(cond
(and (vector? schema) (vector? (first schema))) :nested-vector
(vector? schema) :vector
(map? schema) :map
(keyword? schema) :keyword
:default (type schema)))
@nLight
nLight / rsync_backup.sh
Created January 25, 2013 05:11
Backup over rsync
#!/bin/sh
# http://slava.uma.ru/?a=page&id=137
BACKUP_DIR=/backup/fs
FILES_SRC=/root/adm/backup_src.lst
INCLUDE_FILES_PATTERN=/root/adm/backup_include.lst
EXCLUDE_FILES_PATTERN=/root/adm/backup_exclude.lst
BACKUP_DB_DIR=/backup/db
DB_BACKUP_PREFIX=db
@nLight
nLight / ftp_mirror.sh
Created January 25, 2013 05:09
LFTP Mirror script
#!/bin/bash
# http://serverfault.com/questions/24622/how-to-use-rsync-over-ftp/106365#106365
HOST="your.ftp.host.dom"
USER="username"
PASS="password"
LCD="/path/of/your/local/dir"
RCD="/path/of/your/remote/dir"
lftp -c "set ftp:list-options -a;
open ftp://$USER:$PASS@$HOST;
lcd $LCD;