Skip to content

Instantly share code, notes, and snippets.

sed -i "$(eval "grep -n '### Kibana' /usr/local/bin/start.sh | awk -F ':' '{print \$1-1}'")i curl -X PUT localhost:9200/my_index_$environment/_settings --data-binary '@/tmp/index_settings.json';curl -X PUT localhost:9200/my_index_$environment/_settings --data-binary '@/tmp/index_settings.json';echo modified index settings" /usr/local/bin/start.sh
@wkoszycki
wkoszycki / GetOrderIdsForDataExtractionRequest_Transform.xml
Created October 31, 2016 05:59
sample transformation from xml to json using wso2 enrich
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="GetOrderIdsForDataExtractionRequest_Transform"
trace="disable"
xmlns:orders="http://imshealth.com/bdf/esb/client/orders/schemas/"
xmlns="http://ws.apache.org/ns/synapse">
<!--Remove wrapper element (GetOrderIdsForDataExtraction) by replacing it with his child (Deliverables)-->
<!--example input-->
@wkoszycki
wkoszycki / proxy.sh
Created October 14, 2016 12:08
switch on and off cntlm proxy on arch linux
#!/usr/bin/env bash
# /etc/bash.bashrc
function proxyOff(){
# stop cntlm service
systemctl stop cntlm.service
#remove all proxy env variables
sed -i.bak '/proxy/d' /etc/environment
@wkoszycki
wkoszycki / kill_blocking_session.sql
Last active September 23, 2015 08:40
kill blocking session oracle
SELECT 'ALTER SYSTEM KILL SESSION '''||sid||','|| s.serial#||'''IMMEDIATE;'
FROM sys.GV_$LOCKED_OBJECT L
, DBA_OBJECTS O
, sys.GV_$SESSION S
, sys.GV_$PROCESS P
WHERE L.OBJECT_ID = O.OBJECT_ID
and l.inst_id = s.inst_id
AND L.SESSION_ID = S.SID
and s.inst_id = p.inst_id
AND S.PADDR = P.ADDR(+)
SELECT dbms_metadata.get_ddl(object_type, object_name, owner) || ';' AS object_ddl
FROM DBA_OBJECTS
WHERE
OWNER = '<owner>'
AND OBJECT_TYPE IN (
'TABLE'
, 'INDEX'
, 'SEQUENCE'
, 'VIEW'
)
@wkoszycki
wkoszycki / grant_to_all_tables_of_user.sql
Created August 18, 2015 12:51
Sql script to grant privileges to all tables of certain user
BEGIN
FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner='<user>') LOOP
EXECUTE IMMEDIATE 'grant select,insert,update,delete on '||R.owner||'.'||R.table_name||' to <username>';
END LOOP;
END;
@wkoszycki
wkoszycki / delete_merged_branches_git.sh
Created June 17, 2015 09:27
delete merged branches git
git branch --merged master | grep -v master | xargs -n 1 git branch -D
git remote prune origin