This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
# Set logger with logfile (*.log) in same directory as current | |
# executing file. | |
logger = set_logger('{}.log'.format(os.path.abspath(__file__))) | |
# Write error event with traceback information: | |
try: | |
1 / 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Скрипт для добавления столбцов | |
--в таблицу. IN - список схем и таблиц в строковом виде. | |
use DWH_ODS_dev | |
GO | |
-------------------- | |
declare @t table (sch varchar(50), tabname varchar(50)) | |
declare @sch varchar(50) = '' | |
declare @tabname varchar(50) = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from reg.cropio_export exp | |
where exp.obj in ('machine', 'trailer') | |
and exp.objectid not in ( | |
select max(objectid) as objectid | |
from reg.cropio_export | |
where obj in ('machine', 'trailer') | |
group by obj, uid | |
) | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
import pyodbc | |
conn_tmd = pyodbc.connect(r'DSN=DEV_DWH_TMD;UID=informatica-repos;PWD=HswfhmLjhju2') | |
conn_buff_1c = pyodbc.connect(r'DSN=DWH_1C;UID=dwh_dev;PWD=sd0%7gsh3874') | |
conn_gis_src = pyodbc.connect(r'DSN=DEV_DWH_GIS;UID=appviews;PWD=g*3MDqEP2ghj') | |
conn_op_src = pyodbc.connect(r'DSN=DWH_OP;UID=Infaipc_prod_dwh;PWD=HfcnhjdsqHbceyjr4') | |
conn_sf_src = pyodbc.connect(r'DSN=DWH_SF_src;UID=Infaipc_prod_dwh;PWD={Dsldb;yjqZobr82}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. INSTALL RVM: | |
aboev@aboev-Vostro-5568:/$ cd /tmp | |
aboev@aboev-Vostro-5568:/tmp$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
gpg: keyring `/home/aboev/.gnupg/secring.gpg' created | |
gpg: keyring `/home/aboev/.gnupg/pubring.gpg' created | |
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net | |
gpg: requesting key 39499BDB from hkp server keys.gnupg.net | |
gpg: /home/aboev/.gnupg/trustdb.gpg: trustdb created | |
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <[email protected]>" imported |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Получить последний коммит: git log --name-status HEAD^..HEAD | |
Получить N последних коммитов: git log -n <число коммитов> | |
NB! Удалить все локальные коммиты до указанного: git reset --hard <sha-1 коммита, ДО которого нужно откатиться> (операция необратима) | |
Откатить отдельный файл к предыдущему коммиту: git checkout 59a89329038f6a5be7e2b2dba4e45e0b6c465ea2 -- core/app/models/core/bpe/tasks/send_exemplars.rb | |
Откатить все к предыдущему коммиту: git checkout <sha-1 of that commit> | |
git checkout <хэш коммита, к которому надо откатиться> -- <путь к файлу> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple GET: | |
$("body") | |
.on "change", "select#portfolio-select-year", () -> | |
selected_year = $("select#portfolio-select-year :selected").text() | |
url = "/fixes?selected_year=#{selected_year}" | |
$.get(url) | |
# GET with callback: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CURL | |
# ------------------------------------- | |
# curl post request with no data: | |
curl -X POST http://URL/example.php | |
# curl post request with data: | |
curl -d "data=example1&data2=example2" http://URL/example.cgi | |
# curl POST to a form: | |
curl -X POST -F "name=user" -F "password=test" http://URL/example.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_request_data(fields, model_name): | |
def decorator_method(fn): | |
def decorated(*args, **kwargs): | |
# args[0] == GenericView Object | |
error_messages = [] | |
for field in fields: | |
if not args[0].request.data.get(field, None): | |
error_messages.append("Field '{}' is required for {}".format(field, model_name)) | |
return Response( | |
data={ |
OlderNewer