Skip to content

Instantly share code, notes, and snippets.

View kaloprominat's full-sized avatar

Pavel Kondratev kaloprominat

View GitHub Profile
@kaloprominat
kaloprominat / python: create exec subprecess shell command program stdout stderr result
Last active December 16, 2015 02:28
python: create exec subprecess shell command program stdout stderr result
from subprocess import Popen, PIPE, STDOUT
sprocess = Popen("executing command", shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
result = sprocess.stdout.read()
@kaloprominat
kaloprominat / python: create append format log format string function
Last active December 16, 2015 02:28
python: create append format log format string function
import datetime
dt = datetime.datetime.now()
plog = open('path/to/logfile','a')
plog.write("%s(%s): %s \n" % (dt.strftime("%Y-%m-%d %H:%M"), 'instance id', 'log string' ))
plog.close()
@kaloprominat
kaloprominat / git: auto add modified files to commit
Last active December 16, 2015 02:29
git: auto add modified files to commit
git status | grep modified | cut -f2 | cut -d: -f2 | tr -d ' ' | xargs git add
@kaloprominat
kaloprominat / win7: enable telnet client .bat
Last active December 16, 2015 02:29
win7: enable telnet client
pkgmgr /iu:”TelnetClient”
@kaloprominat
kaloprominat / cvs: revert restore file previous version
Last active December 16, 2015 02:29
cvs: revert restore file previous version
cvs update -j cur_version -j old_version oldfile
@kaloprominat
kaloprominat / bash: sort basic field col ip
Created April 11, 2013 11:55
bash: sort basic field col ip
sort -n -t'separator' -k'col1,col2'
@kaloprominat
kaloprominat / php: if then else shorthand .php
Created April 11, 2013 11:56
php: if then else shorthand
$var = (condition ? true : false);
@kaloprominat
kaloprominat / asterisk: peer debug peer
Created April 11, 2013 11:56
asterisk: peer debug peer
sip set debug <peer>
@kaloprominat
kaloprominat / openssl: generate password
Created April 11, 2013 11:57
openssl: generate password
openssl rand -base64 6
@kaloprominat
kaloprominat / jar: create jar archive
Created April 11, 2013 11:58
jar: create jar archive
jar cf file_path.jar <files>