Skip to content

Instantly share code, notes, and snippets.

@swiatczak
swiatczak / gist:a5f151098f7c8720d430e238ed0b8a5c
Created April 12, 2017 04:00 — forked from TerryMooreII/gist:3773572
Get Oracle DBMS_Output from Python's cx_Oracle library
import cx_Oracle
conn = cx_Oracle.Connection("userid/password@tns")
curs = conn.cursor()
curs.callproc("dbms_output.enable")
sqlCode = """
some long
sql code
with dbms_output
@swiatczak
swiatczak / indexDecolor.py
Created June 16, 2016 23:57 — forked from jfcamel/indexDecolor.py
a gimp plugin (python-fu)
# -*- coding: utf-8 -*-
from gimpfu import *
import os
import glob # unused
colorpalette = []
def decolorFiles(dirname, ext, suffix):
''' basic CAS authenticated page scraping using Requests and BeautifulSoup
'''
__author__ = "swiatczak"
import requests
from bs4 import BeautifulSoup as soup
import urllib
def casSoup(user, password, serviceURL, casURL, targets = None):
''' somehow simplistic approach that authenticates requests against CAS using Requests.Session
@swiatczak
swiatczak / puzzles.py
Last active April 5, 2016 01:50
puzzles.py
''' silly/fun puzzles and a proof of failures (actually this version finds a solution :( )
author: swiatczak
doWork -
this one solves the following p
'''
import operator
BDAYSD = { 13: {5:1, 7:1}, 14:{7:1 , 8:1}, 15:{5:1,8:1}, 17:{6:1,8:1}, 18:{6:1}, 19:{5:1} }
BDAYSM = { 5: {13:1, 15:1, 19:1}, 6: {17:1, 18:1}, 7: {13:1, 14:1}, 8:{14:1, 15:1, 17:1} }
def removeObvious(status = False):
if not status:
b = {a: {d: BDAYSD[a][d] for d in BDAYSD[a] if BDAYSD[a][d] == 1} for a in BDAYSD }
for d in b:
#purpose: little birgday riddle dramma helper
#author: Janusz Swiatczak
#pthon ver 2.7
BDAYSD = { 13: {5:1, 7:1}, 14:{7:1 , 8:1}, 15:{5:1,8:1}, 17:{6:1,8:1}, 18:{6:1}, 19:{5:1} }
BDAYSM = { 5: {13:1, 15:1, 19:1}, 6: {17:1, 18:1}, 7: {13:1, 14:1}, 8:{14:1, 15:1, 17:1} }
def removeObvious():
b = {a: {d: BDAYSD[a][d] for d in BDAYSD[a] if BDAYSD[a][d] == 1} for a in BDAYSD }
m = {a: {d: BDAYSM[a][d] for d in BDAYSM[a] if BDAYSM[a][d] == 1} for a in BDAYSM }
@swiatczak
swiatczak / logparserstream.coffee
Last active August 29, 2015 14:15
coffee PeopleSoft trace file (SQL+) extractor = work in progress - currently works for SQLs (on both .trc and .tracesql)
Transform = require('stream').Transform
stream = require 'stream'
split = require 'split'
# references:
# http://nicolashery.com/parse-data-files-using-nodejs-streams/
# http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
# https://github.com/substack/stream-handbook
# https://www.npmjs.com/package/split
# http://codewinds.com/blog/2013-08-04-nodejs-readable-streams.html
@swiatczak
swiatczak / windows_access_list_info.txt
Created October 22, 2014 22:56
Windows folder security/access info
src: https://social.technet.microsoft.com/Forums/windowsserver/en-US/1d27ad79-2fa9-4e0c-9b2d-249809c64391/win2008r2-context-menu-empty-document-template-if-outside-of-user-folder?forum=winservergen
icacls C:\ABC
@swiatczak
swiatczak / psprojectparser.coffee
Created August 18, 2014 05:07
CoffeeScript - parse PeopleSoft project XML export file
path = require 'path'
fs = require 'fs'
expat = require 'node-expat'
#
# peoplesoft XML project file parser - similar to:
# python version: https://github.com/swiatczak/psprojectparser
#
# just playing with class construction and chaining of the methods
#
@swiatczak
swiatczak / psprojectparser_fibers.coffee
Last active August 29, 2015 14:05
CoffeeScript - parse PeopleSoft project XML export file
path = require 'path'
fs = require 'fs'
Fiber = require 'fibers'
Future = require 'fibers/future'
wait = Future.wait
readFile = Future.wrap(fs.readFile)
#
# peoplesoft XML project file parser - similar to:
# python version: https://github.com/swiatczak/psprojectparser