Skip to content

Instantly share code, notes, and snippets.

View stpierre's full-sized avatar

Chris St. Pierre stpierre

  • Petal Card, Inc.
  • Lincoln, NE
View GitHub Profile
data_ordered = [int(l) for l in open("gamedata/tf2_50k.dat").readlines()]
peaks = []
in_peak = False
for point in data_ordered:
if point > 27395:
if in_peak:
peaks[-1] += 5
else:
peaks.append(5)
in_peak = True
% ansible-lint test.yml
Couldn't parse task at Unknown (no action detected in task. This often indicates a misspelled module name, or incorrect module path.)
{ '__line__': 5, 'bogus': True, 'name': 'bogus'}
{%- if storage.cinder_enabled and storage.cinder_driver != ['nfs'] %}
CinderVolumes.create_and_delete_snapshot:
{%- for storage_driver in storage.cinder_driver|reject("equalto", "nfs") %}
{%- for cinder_api in cinder_api_versions|default([{"version": 1, "service_type": "volume"}]) %}
- args:
force: false
context:
users:
tenants: {{smoke|default(2)}}
users_per_tenant: {{smoke|default(2)}}
MariaDB [merit_scratch]> CREATE TABLE `MERIT_BADGE` (
-> `BadgeID` INT(11) UNSIGNED AUTO_INCREMENT,
-> `BadgeName` VARCHAR(256) NOT NULL,
-> `AlternateGroupID` INT(11) UNSIGNED,
-> PRIMARY KEY (`BadgeID`));
Query OK, 0 rows affected (0.01 sec)
MariaDB [merit_scratch]> CREATE TABLE `ALTERNATE_GROUPS` (
-> `AlternateGroupID` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
-> PRIMARY KEY (`AlternateGroupID`));
@stpierre
stpierre / gist:ec64422d3713c1a6149a
Created May 7, 2015 12:37
Bash comparison operators
$ a=4
$ b=04
$ test "$a" -eq "$b"
$ echo $?
0
$ test "$a" = "$b"
$ echo $?
1
@stpierre
stpierre / gist:4088324
Created November 16, 2012 15:42
Python FizzBuzz
for n in range(1, 101):
output = []
if n % 3 == 0:
output.append("Fizz")
if n % 5 == 0:
output.append("Buzz")
if not output:
print(str(n))
else:
print("".join(output))
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index cc6cf13..db85c2e 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -141,7 +141,7 @@ class BaseCore(object):
self.logger.error("Failed to update database schema: %s" % err)
except ImportError:
# assume django is not installed
- pass
+ raise
diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec
index 191bfaf..301cdfd 100644
--- a/misc/bcfg2.spec
+++ b/misc/bcfg2.spec
@@ -268,6 +268,10 @@ mv build/dtd %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version}/
%{__mkdir_p} %{buildroot}%{_localstatedir}/cache/bcfg2
+# mandriva and RHEL 5 cannot handle %ghost without the file existing,
+# so let's touch a bunch of empty config files
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index f423bea..9fe8c2b 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -1199,27 +1199,32 @@ class SimpleConfig(FileBacked,
self.remove_section(section)
self.read(self.name)
- def get(self, section, option, default=None):
+ def get(self, section, option, **kwargs):
A new release for Bcfg2 1.2.1 is now available at:
ftp://ftp.mcs.anl.gov/pub/bcfg
Bcfg2 1.2.1 is primarily a bugfix release, with over 2 dozen reported
bugs and dozens more unreported bugs fixed. The only significant
change from 1.2.0 is that regular expression support in Rules is now
optional, and off by default; see
http://docs.bcfg2.org/server/plugins/generators/rules.html#using-regular-expressions-in-rules
for more details.