- GitHub Staff
- https://www.peterbe.com
- @peterbe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
import os, sys | |
import csv | |
import code | |
queryfile = sys.argv[1] | |
args = sys.argv[2:] | |
query = open(queryfile).read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socorro_integration_test=# select count(*) from graphics_device; | |
count | |
------- | |
7131 | |
(1 row) | |
socorro_integration_test=# select * from graphics_device order by random() limit 10; | |
graphics_device_id | vendor_hex | adapter_hex | vendor_name | adapter_name | |
--------------------+------------+-------------+---------------------------------------+-------------------------------------------- | |
1838 | 0x1039 | 0x900 | SİS | SiS 900 SiS 900 Fast Ethernet Adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RemoteVerifier(object): | |
""" | |
Verifies BrowserID assertions using a remote verification service. | |
By default, this uses the Mozilla Persona service for remote verification. | |
""" | |
verification_service_url = 'https://verifier.login.persona.org/verify' | |
requests_parameters = { | |
'timeout': 5 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import requests | |
>>> requests.__version__ | |
'0.13.0' | |
>>> response = requests.get('https://crash-stats.mozilla.com/api/CrontabberState/') | |
>>> type(response.json) | |
<type 'dict'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[sentry]] | |
#+include ./common_sentry.ini | |
# DSN for Sentry via raven | |
dsn=https://24131b4096fd4a9c..SNIP..40ad84e9070324cdf99d@errormill.mozilla.org/31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_rollback_on_save_processed(self): | |
mock_logging = mock.Mock() | |
mock_postgres = mock.Mock() | |
required_config = PostgreSQLCrashStorage.get_required_config() | |
required_config.add_option('logger', default=mock_logging) | |
config_manager = ConfigurationManager( | |
[required_config], | |
app_name='testapp', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(socorro)peterbe@mbp:~/dev/MOZILLA/SOCORRO/socorro (master %>)$ which reroy.sh | |
/Users/peterbe/bin/reroy.sh | |
(socorro)peterbe@mbp:~/dev/MOZILLA/SOCORRO/socorro (master %>)$ cat `which reroy.sh` | |
#!/bin/bash | |
export LEEROY_URL="https://leeroybot.herokuapp.com/" | |
LEEROY_RERUN="https://raw.github.com/lonnen/leeroy-rerun/master/leeroy-rerun.py" | |
# Usage | |
[[ -z $1 ]] || [[ -z $2 ]] && { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> cgi.parse_qsl('date=xxx&date=yyy&name=peter') | |
[('date', 'xxx'), ('date', 'yyy'), ('name', 'peter')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> cgi.parse_qsl('date=xxx&date=yyy&name=peter') | |
[('date', 'xxx'), ('date', 'yyy'), ('name', 'peter')] | |
>>> things = {} | |
>>> for key, value in cgi.parse_qsl('date=xxx&date=yyy&name=peter'): | |
... if key in things: | |
... if not isinstance(things[key], list): things[key] = [things[key], value] | |
... else: things[key].append(value) | |
... else: things[key] = value | |
... | |
>>> things |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> for key, values in cgi.parse_qs('date=xxx&date=yyy&name=peter').items(): | |
... if len(values) == 1: values = values[0] | |
... things[key] = values | |
... | |
>>> things | |
{'date': ['xxx', 'yyy'], 'name': 'peter'} |