Skip to content

Instantly share code, notes, and snippets.

View markgajdosik's full-sized avatar

Mark Gajdosik markgajdosik

  • Reading, United Kingdom
View GitHub Profile
<script id="vertexShader" type="x-shader/x-vertex">
varying vec3 vNormal;
void main()
{
vNormal = normalize( normalMatrix * normal );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<!-- fragment shader a.k.a. pixel shader -->
def main():
print('Hello world!')
if __name__ == '__main__':
main()
<body>
<div id="container">
<div id="content">
<h1>Centered div</h1>
</div>
</div>
</body>
#container{
position: absolute;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 50%, #ffffff 50%, #ededed 95%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#ffffff), color-stop(50%,#ffffff), color-stop(95%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 50%,#ffffff 50%,#ededed 95%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 50%,#ffffff 50%,#ededed 95%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 50%,#ffffff 50%,#ededed 95%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 50%,#ffffff 50%,#ededed 95%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
HTTPRequest(protocol='http', host='172.16.0.1:80', method='GET', uri='/heartbeat/mtcdp_otterham_quay_gb', version='HTTP/1.0', remote_ip='172.16.1.54', headers={'X-Real-Ip': '172.16.1.54', 'Host': '172.16.0.1:80', 'X-Scheme': $
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1346, in _when_complete
callback()
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1367, in _execute_method
self._when_complete(method(*self.path_args, **self.path_kwargs),
File "/home/rdam/rdam_server/handlers/data.py", line 179, in get
db.Session.query(db.Heartbeat).filter_by(id=min_id).delete()
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2670, in delete
delete_op.exec_()
Apr 10 09:38:05 mtcdp user.info kernel: usb 1-1: USB disconnect, address 100
Apr 10 09:38:08 mtcdp user.info kernel: usb 1-1: new full speed USB device using at91_ohci and address 101
Apr 10 09:38:13 mtcdp user.err kernel: usb 1-1: device not accepting address 101, error -62
Apr 10 09:38:13 mtcdp user.err kernel: hub 1-0:1.0: unable to enumerate USB device on port 1
Apr 10 09:38:14 mtcdp user.info kernel: usb 1-1: new full speed USB device using at91_ohci and address 103
Apr 10 09:38:14 mtcdp user.info kernel: usb 1-1: New USB device found, idVendor=1bc7, idProduct=0021
Apr 10 09:38:14 mtcdp user.info kernel: usb 1-1: New USB device strings: Mfr=18, Product=19, SerialNumber=20
Apr 10 09:38:14 mtcdp user.info kernel: usb 1-1: Product: Telit Wireless Module
Apr 10 09:38:14 mtcdp user.info kernel: usb 1-1: Manufacturer: Telit wireless solutions
Apr 10 09:38:14 mtcdp user.info kernel: usb 1-1: SerialNumber: 351579051972428
def save_configuration():
'''
Saves program configuration in the `config` module to a JSON file specified
via `config.general.CONFIG_PATH`. The function will skip any configuration
directives not listed in the provided `_ADJUSTABLE` lists.
'''
log.info('Saving program configuration.')
configuration = {}
# Get all section classes in the `config` module.
sections = inspect.getmembers(config, inspect.isclass)
@markgajdosik
markgajdosik / update_returning.py
Last active September 11, 2016 03:04
Update-returning support for Django 1.8. Based on: https://github.com/kanu/django-update-returning
"""
Implements manager with "UPDATE .. RETURNING" clause support. Columns following
the "RETURNING" clause may be provided using `values_list()` method. If not
specified, the update statement will yield full records.
Queries executed with use of `UpdateReturningManager` or
`UpdateReturningDefaultManager` return a generator allowing easy iterating over
the returned entries.
Based on https://github.com/kanu/django-update-returning, with modifications to
cursor.execute(textwrap.dedent('''
DROP TABLE IF EXISTS repeating;
CREATE TEMPORARY TABLE repeating ON COMMIT DROP
AS SELECT
{bat}.row, {cucm}.used_for, {bat}.field_id, {bat}.index
FROM {bat} INNER JOIN {cucm} ON
{cucm}.system_type = %s AND
{bat}.field_id = {cucm}.id
WHERE {bat}.row IN %s AND {cucm}.used_for IN %s {index}
'''))