This file contains hidden or 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 csv | |
class CsvMapper(): | |
"""export database queries to csv""" | |
def __init__(self, data): | |
self.data = data | |
self.headers = data['headers'] | |
self.records = data['records'] | |
def write_csv(self, destination): |
This file contains hidden or 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
// to export and import Oracle database user as an alternative to old imp/exp utility can be used next commands: | |
// In sql editor run: | |
// export dump file in Oracle storage | |
DECLARE | |
hdnl NUMBER; | |
BEGIN | |
hdnl := DBMS_DATAPUMP.open( operation => 'EXPORT', job_mode => 'SCHEMA', job_name=>null); | |
DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'dumpfile.dump', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file); | |
DBMS_DATAPUMP.add_file( handle => hdnl, filename => 'dumplog.log', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_log_file); | |
DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''EXPORTED DB USER'')'); |
This file contains hidden or 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
#NOTE: before running commands check output list to remove | |
# remove untagged docker images: | |
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) | |
#remove stopped docker containers: | |
docker rm $(docker ps -q -f status=exited) |
This file contains hidden or 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 any database editor run SQL: | |
SELECT SID, SERIAL#, STATUS | |
FROM V$SESSION | |
WHERE USERNAME = '<SCHEME>'; | |
# then in SQLPlus: | |
exec rdsadmin.rdsadmin_util.kill(SID, SERIAL#); | |
# drop it: | |
drop user <username> cascade; |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'english' | |
require 'rubocop' | |
ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
changed_files = `git status --porcelain`.split(/\n/). | |
select { |file_name_with_status| | |
file_name_with_status =~ ADDED_OR_MODIFIED |