Skip to content

Instantly share code, notes, and snippets.

@andruhon
andruhon / rsync_ssh.sh
Created January 6, 2016 18:19
rsync via ssh from current dir to host:/path; -a archive, -v verbose, -r recursive, -e remote shell programm, exclude node modules
rsync -avr -e "ssh" --exclude 'node_modules*' ./* host:/path
@andruhon
andruhon / slice_git.bat
Created January 6, 2016 18:21
Windows CMD one-line command to copy difference of two GIT commits into specific directory preserving directories hierarchy:
git diff --name-only yrc0m1 yrc0m2|sed s:/:\\:g > report.txt && for /F %F in ('cat report.txt') do xcopy %F c:\m1m2diff\%F && del report.txt
#*xcopy will ask you to confirm wither the path is file or directory for each of your changed files. As far as diff returns only files changed, you can just do long F button press :-) Unfortunately I did not succeed to find a flag to suppress this warning with F option.
#It consists of following subcommands:
#1. git diff --name-only yrc0m1 yrc0m2 - returns list of changed files between commits yrc0m1 and yrc0m2;
#2. sed s:/:\\:g - piped with | after previous one, converting Linux slashes to windows slashes;
#3. > report.txt - oputput of previous two commands: all relative filepaths are saved in report.txt;
#4. for /F %F in ('cat report.txt') do xcopy %F c:\m1m2diff\%F - iterates through lines in report.txt and copying file creating all not-existing directories from it's relative path (we suppose that c:\m1m2diff\ directory already exists)
#5. del report.txt - simply de
@andruhon
andruhon / html5dialog.d.ts
Last active February 22, 2016 21:11
HTMLDialogElement TypeScript definition
interface HTMLDialogElement extends HTMLElement {
open: boolean,
returnValue: string,
close: ()=>any,
show: ()=>any,
showModal: ()=>any
}
declare var HTMLDialogElement: {
prototype: HTMLDialogElement;
@andruhon
andruhon / ljscaner.side
Created August 17, 2019 12:17
LJ blog scaner for Selenium IDE or selenium-side-runner, replace YOUR with your journal LAST_SCANNED_POST with last post id. Finds all links and logs them
{
"id": "7908efff-abd8-45b6-9a03-536bd06294e9",
"version": "2.0",
"name": "ljscaner",
"url": "https://YOUR.livejournal.com",
"tests": [{
"id": "33fd5216-ee07-456a-a9b6-1dd23a464bbd",
"name": "scan lj",
"commands": [{
"id": "d1f835b7-ab7f-4b22-a4bb-ac32b2f655e3",

All commands below are in normal mode unless specified otherwise. Hit esc on keyboard to enter normal mode.

Search and Replace

/ search forward, ? search backward, for example
?text search backward for the word "text", /text\c case-insensitive search
:let @/ = "" clear search context;

:%s/text/replacement/gic interactive search. y - replace, n - skip, a - all, q - quit, l - replace one and quit