Skip to content

Instantly share code, notes, and snippets.

>>> range(5)
[0, 1, 2, 3, 4]
>>> sum(range(5))
10
>>> def is_even(x):
... return x % 2 == 0
...
>>> [x for x in range(5) if is_even(x)]
[0, 2, 4]
>>> sum([x for x in range(5) if is_even(x)])
GDS::SSO.config do |config|
config.user_model = "User"
config.oauth_id = ENV['SIGNON_OAUTH_ID']
config.oauth_secret = ENV['SIGNON_OAUTH_SECRET']
config.oauth_root_url = Plek.current.find("signon")
end
```
backend-lb in /etc/nginx/sites-enabled/specialist-publisher.integration.publishing.service.gov.uk
```
location /cma-cases {
proxy_set_header Host specialist-publisher-rebuild.integration.publishing.service.gov.uk;
proxy_pass https://specialist-publisher-upstream;
}
[backup0.backup.provider1.production.govuk.service.gov.uk] sudo: /opt/puppet/tools/bootstrap
[backup0.backup.provider1.production.govuk.service.gov.uk] sudo: /opt/puppet/tools/puppet-apply --environment production
[backup0.backup.provider1.production.govuk.service.gov.uk] out: Warning: Could not retrieve fact fqdn
[backup0.backup.provider1.production.govuk.service.gov.uk] out: Warning: Host is missing hostname and/or domain: offsite-backup-1
[backup0.backup.provider1.production.govuk.service.gov.uk] out: Error: Must pass graphite_disks to Class[Base::Mounts] at /opt/puppet/manifests/nodes.pp:3 on node offsite-backup-1
[backup0.backup.provider1.production.govuk.service.gov.uk] out: Error: Must pass graphite_disks to Class[Base::Mounts] at /opt/puppet/manifests/nodes.pp:3 on node offsite-backup-1
[backup0.backup.provider1.production.govuk.service.gov.uk] out:
diff --git a/modules/govuk_postgresql/manifests/db.pp b/modules/govuk_postgresql/manifests/db.pp
index ce2179b..4624170 100644
--- a/modules/govuk_postgresql/manifests/db.pp
+++ b/modules/govuk_postgresql/manifests/db.pp
@@ -16,6 +16,10 @@
# call to postgresql_password to enable it to be passed in to the
# postgresql::server::db type.
#
+# [*collectd_password*]
+# The plaintext password for the 'collectd' PostgreSQL user to collect
var expectedReplicaSetMembers = [
{
_id: 0,
host: 'api-mongo-1:27017'
},
{
_id: 1,
host: 'api-mongo-2:27017'
},
{
@alexmuller
alexmuller / git-list-old-files.sh
Created July 27, 2015 08:56
Git: list files not recently modified
git ls-tree -r --name-only HEAD | while read filename; do
echo "$(git log -1 --format="%ad" --date=iso -- $filename) $filename"
done | sort
require 'yaml'
vdcs = ['api', 'backend', 'frontend', 'management', 'redirector', 'router']
providers = ['production_skyscape', 'staging_carrenza']
parsed = []
vdcs.each do |vdc|
providers.each do |provider|
$ curl --silent http://www.tomscott.com/updates.xml | grep "10 Jul 2015" -C4
<item>
<title>This RSS feed now includes videos from YouTube!</title>
<link>http://www.youtube.com/c/TomScottGo</link>
<description>Hope that helps.</description>
<pubDate>Fri, 10 Jul 2015 07:30:00 -0700</pubDate>
<guid isPermaLink="false">ts-1-83q94ujler</guid>
</item>
@alexmuller
alexmuller / header_method.rb
Last active August 29, 2015 14:13
A firebreak project to enable Content-Security-Policy on GOV.UK
def set_content_security_policy
asset_hosts = "http://static.dev.gov.uk http://assets-origin.dev.gov.uk"
default_src = "default-src 'none'"
script_src = "script-src #{asset_hosts} http://www.google-analytics.com 'unsafe-inline'"
style_src = "style-src #{asset_hosts} 'unsafe-inline'"
img_src = "img-src #{asset_hosts}"
report_uri = "report-uri http://www.dev.gov.uk:8080/e"
csp_header = "#{default_src}; #{script_src}; #{style_src}; #{img_src}; #{report_uri}"