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 / 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;
@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 / 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 / index.html
Created May 9, 2014 18:01
Functional lenses in React.js with DrBoolean/lenses
<!DOCTYPE html>
<html>
<head>
<title>React JS Lenses</title>
<script src="react-with-addons.min.js"></script>
<script src="JSXTransformer.js"></script>
<!-- https://github.com/DrBoolean/lenses/blob/master/dist/lenses.browser.js -->
<script src="lenses.browser.js"></script>
<!-- https://github.com/DrBoolean/pointfree-fantasy/blob/master/dist/pointfree.browser.js -->
@nLight
nLight / redis_set.rb
Created May 29, 2014 09:45
Ruby array-like wrapper for redis sets.
require 'forwardable'
class RedisSet
extend Forwardable
def_delegators :to_ary, :first, :push, :shift, :size, :each, :map
def initialize(redis, key)
@redis = redis
@key = key
# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S
PROMPT='%{$fg_bold[green]%}λ%{$reset_color%} %~/ $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
@nLight
nLight / .bashrc
Last active March 24, 2017 20:16
dots
# Git
## Git undo
alias gundo="git reset HEAD~1"
## Resolve conflicts
alias conflicts='git status -s | grep -e "^\(DD\|AU\|UD\|UA\|DU\|AA\|UU\)" | cut -d " " -f2'
alias resolve='conflicts | xargs subl'
alias cadd='conflicts | xargs git add'
## WIP
@nLight
nLight / keybase.md
Created March 2, 2015 08:58
keybase.md

Keybase proof

I hereby claim:

  • I am nlight on github.
  • I am nlight (https://keybase.io/nlight) on keybase.
  • I have a public key whose fingerprint is 8FED C304 4FB5 D7B2 DD66 4A50 66CC 39C2 2061 3D8F

To claim this, I am signing this object:

@nLight
nLight / README.md
Last active November 21, 2015 13:38
GoPro Timer Proof of Concept
@nLight
nLight / .ssh-config
Created June 8, 2016 09:22
SSH Proxy
Host ssh-proxy
HostName proxy.example.com
User ubuntu
IdentityFile ~/.ssh/keys.pem
Host !ssh-proxy *
ProxyCommand ssh -q -W %h:%p ssh-proxy
ForwardAgent yes