09/24: Windows > Remote Desktop
09/23: Linux > SELinux
HOWTO: Turning off or disabling SELinux
Temporarily:
echo 0 > /selinux/enforce
Permanent:
vi /etc/sysconfig/selinux
SELINUX=disabled
Temporarily:
echo 0 > /selinux/enforce
Permanent:
vi /etc/sysconfig/selinux
SELINUX=disabled
09/17: Oracle > get DDL (metadata)
Get table and index DDL the easy way
set heading off;
set echo off;
Set pages 999;
set long 90000;
spool ddl_list.sql
select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;
# funcy spool file name
COLUMN system_date NEW_VALUE YYYYMMDD
SELECT to_char(sysdate,'YYYYMMDD') system_date FROM DUAL;
spool myspool_&&YYYYMMDD..log
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
spool off;
set heading off;
set echo off;
Set pages 999;
set long 90000;
spool ddl_list.sql
select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;
# funcy spool file name
COLUMN system_date NEW_VALUE YYYYMMDD
SELECT to_char(sysdate,'YYYYMMDD') system_date FROM DUAL;
spool myspool_&&YYYYMMDD..log
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
spool off;
Oracle :: Tablespace Information
Or
select file_name, bytes, autoextensible, maxbytes, tablespace_name from dba _data_files;
Or
select file_name, bytes, autoextensible, maxbytes, tablespace_name from dba _data_files;
09/10: Linux > pushd popd
09/05: Python thread dumps
Python thread dumps
import sys
import traceback
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
def stacktraces():
code = []
for threadId, stack in sys._current_frames().items():
code.append("\n# ThreadID: %s" % threadId)
for filename, lineno, name, line in traceback.extract_stack(stack):
code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
if line:
code.append(" %s" % (line.strip()))
return highlight("\n".join(code), PythonLexer(), HtmlFormatter(
full=False,
# style="native",
noclasses=True,
))
import sys
import traceback
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
def stacktraces():
code = []
for threadId, stack in sys._current_frames().items():
code.append("\n# ThreadID: %s" % threadId)
for filename, lineno, name, line in traceback.extract_stack(stack):
code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
if line:
code.append(" %s" % (line.strip()))
return highlight("\n".join(code), PythonLexer(), HtmlFormatter(
full=False,
# style="native",
noclasses=True,
))