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
image=$1 | |
if [ -f $image ]; then | |
exit 0 | |
fi | |
path=$(mktemp --directory lxdapi.busybox.XXXXXXXX) | |
arch=$(uname --machine) |
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
[env] 17/06 2016 17:29:30 jpic@lue ~ | |
$ ansible-playbook test.yml | |
[WARNING]: Host file not found: /etc/ansible/hosts | |
[WARNING]: provided hosts list is empty, only localhost is available | |
PLAY [localhost] *************************************************************** | |
TASK [setup] ******************************************************************* |
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
[[runners]] | |
name = "jpic" | |
url = "https://gitlab.com/ci" | |
token = "redacted" | |
executor = "docker" | |
[runners.docker] | |
tls_verify = false | |
image = "jpic/ansible-git:jessie" |
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
# Generated by iptables-save v1.4.21 on Tue May 10 17:03:12 2016 | |
*filter | |
:INPUT ACCEPT [0:0] | |
:FORWARD DROP [0:0] | |
:OUTPUT ACCEPT [1228037347:3674412776210] | |
:LOGDROP - [0:0] | |
:TCP - [0:0] | |
:UDP - [0:0] | |
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
-A INPUT -i lo -j ACCEPT |
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
#!/bin/bash | |
light=off | |
while true; do | |
if hcitool scan | grep 'iPhone de Micka'; then | |
if [ $light = off ]; then | |
echo 'allumer la lampe' | |
light=on | |
fi |
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 TestApp(AppConfig): | |
name = 'select2_one_to_one' | |
def ready(self): | |
model = self.get_model('TestModel') | |
# Perhaps that's the kind of nice place to override this kind of things | |
model._meta.get_field('test').formfield_defaults['widget'] = forms.RadioSelect | |
# django-autocomplete-light users would execute something like: | |
model._meta.get_field('test').formfield_defaults['widget'] = autocomplete.Select2(url='my_autocomplete_url') |
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
# upstream: https://gist.github.com/cliffano/9868180 | |
# Dunno if it still shares a single line with the original, but still i think the license forces me to post it. So here it is, my F****ING AWESOME CLASSY DEFAULT OUTPUTTER OVERRIDE !! | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
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 ModelChoiceModelField(ModelChoiceField): | |
def value_from_object(self, instance, name): | |
return getattr(instance, name) | |
def save_form_data(self, instance, name, value): | |
setattr(instance, name, value) |
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 GFKFormBusiness(object): | |
def value_from_object(self, instance, name): | |
return getattr(instance, name) | |
def save_form_data(self, instance, name, value): | |
setattr(instance, name, value) | |
class TestForm(forms.ModelForm): | |
test = autocomplete.QuerySetSequenceModelField( |
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
""" | |
ModelForm mixin that supports virtual fields, ie. GenericForeignKey. | |
By default, Django's ModelForm will not update the instance's virtual fields | |
even if a matching form field was given to the form. For example:: | |
class YourForm(forms.ModelForm): | |
gfk_name = SomeField() | |
instance = YourModel.objects.get(pk=4) | |
# Django doesn't populate virtual fields by default, compensate manually: | |
initial = {'gfk_name': instance.gfk_name} | |
# Use the form as usual |