Skip to content

Instantly share code, notes, and snippets.

Luper Rouch flupke

  • GoPro
  • France
Block or report user

Report or block flupke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:00779514c97dad1825e8
In the end, salt-cloud is just used to retrieve instances details from EC2 API.
You still need to setup a provider in salt for the region where your instances
are launched.
Here is what the reactor does when a minion comes up:
* wait for the new instances to ping the salt master when it receives
a notification from Amazon SNS
* use salt-cloud CloudClient to retrieve instance instance details from EC2 API
* stores the instance-id / minion-name association in a sqlite database
View ec2-autoscale.py
#!py
import pprint
import json
import binascii
import functools
import traceback
import os
import os.path as op
import sqlite3
@flupke
flupke / gist:5888808
Created Jun 28, 2013
A theme for pudb somewhat reproducing vim's desert colorscheme (needs 256 colors terminal).
View gist:5888808
default = 'light gray'
strings = 'h217'
keywords = add_setting('h222', 'bold')
callables = 'h120'
breakpoints = 'h203'
comments = 'h116'
background = 'h236'
focused_background = 'h238'
current_background = 'h240'
View base.py
def _get_next_or_previous_by_FIELD(self, field, is_next, **kwargs):
if not self.pk:
raise ValueError("get_next/get_previous cannot be used on unsaved objects.")
op = is_next and 'gt' or 'lt'
order = not is_next and '-' or ''
param = smart_str(getattr(self, field.attname))
q = Q(**{'%s__%s' % (field.name, op): param})
q = q|Q(**{field.name: param, 'pk__%s' % op: self.pk})
qs = self.__class__._default_manager.using(self._state.db).filter(**kwargs).filter(q).order_by('%s%s' % (order, field.name), '%spk' % order)
try:
You can’t perform that action at this time.