Skip to content

Instantly share code, notes, and snippets.

View dmitryTsatsarin's full-sized avatar

Dmitry Tsatsarin dmitryTsatsarin

View GitHub Profile
@dmitryTsatsarin
dmitryTsatsarin / .py
Created March 4, 2016 14:43
Заменить в выделенном тексте все пробелы на нижния подчеркивания и сделать все буквы маленькими (скрипт для AutoKey)
# Enter script code
text = clipboard.get_selection()
text = text.lower().replace(' ', '_')
keyboard.send_key("<delete>")
keyboard.send_keys("%s"% text)
@dmitryTsatsarin
dmitryTsatsarin / .py
Last active November 27, 2015 13:44
GET /api/vendor/service_provider_user/order/<pk>/deferred-price/options
{
"count": 2,
"previous": null,
"results": [{
"pk": 5,
"label": "option1"
}, {
"pk": 6,
"label": "option2"
}],
@dmitryTsatsarin
dmitryTsatsarin / gist:76b58a3cbd6c3c7dbf55
Last active August 29, 2015 14:24
Extendent django choice. You can access by name like a dictionary
__author__ = 'dmitry'
class StatesCreator(object):
def __init__(self, states_dict):
self.states_dict = states_dict
def for_choice(self):
return tuple(zip(self.states_dict.values(), self.states_dict.keys()))
def __getitem__(self, key):
~/Загрузки$ proxylocal 8000 -v --host testho2222st
I, [2015-06-30T18:19:36.285757 #17352] INFO -- : Run with options {:server_host=>"proxylocal.com", :server_port=>"8282", :local_port=>"8000", :tls=>false, :verbose=>true, :hosts=>["testho2222st"], :version=>"0.3.1"}
Connection has been terminated. Trying to reconnect...
Connection has been terminated. Trying to reconnect...
Connection has been terminated. Trying to reconnect...
Connection has been terminated. Trying to reconnect...
^C
~/Загрузки$ telnet proxylocal.com 8282
Trying 46.101.189.242...
telnet: Unable to connect to remote host: No route to host
#!/usr/bin/python
import subprocess
import os.path
import re
import sys
#Requires dconf tool - available in Mint as dconf-cli
#run with -r argument to remove created shortcuts
[
{
u'pk':1,
u'name':u'',
u'parent':None,
u'children':[
{
u'pk':11,
u'name':u'subcategory'
},
@dmitryTsatsarin
dmitryTsatsarin / gist:9dd52e3be3d012758a77
Created June 19, 2015 08:24
рабочий .bashrc
export HISTTIMEFORMAT="%d/%m/%y %T "
# python virtualenv
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
export PROJECT_HOME=~/projects/
export WORKON_HOME=~/venvs/
export VIRTUAL_ENV_DISABLE_PROMPT=1
source /usr/local/bin/virtualenvwrapper.sh
fi
linux-vdso.so.1 => (0x00007fff96175000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f584e890000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f584e672000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f584e469000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f584e253000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f584de8e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f584ed09000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f584db87000)
the
of
to
and
a
in
is
it
you
that