Skip to content

Instantly share code, notes, and snippets.

View Valian's full-sized avatar
🔮
Diving deep into Elixir

Jakub Skałecki Valian

🔮
Diving deep into Elixir
View GitHub Profile
@Valian
Valian / example_forms.py
Last active February 8, 2021 14:32
Django MultipleFormMixin for displaying dynamic number of forms on the same page. Compatible with the standard FormMixin.
class ContactForm(forms.Form):
name = forms.CharField(max_length=60)
message = forms.CharField(max_length=200, widget=forms.TextInput)
class SubscriptionForm(forms.Form):
email = forms.EmailField()
want_spam = forms.BooleanField(required=False)
@Valian
Valian / Dockerfile
Last active December 28, 2024 10:45
Fast way to fix not working ctype.util.find_library() in python alpine. Rather quick workaround, but works :)
FROM python:2-alpine
ENV PYTHONUNBUFFERED=1 \
PROJECT_ROOT=/srv
COPY requirements.txt $PROJECT_ROOT/
RUN apk add --update --virtual build-dependencies build-base python-dev \
&& cd $PROJECT_ROOT && pip install -r requirements.txt \
@Valian
Valian / script.js
Last active November 30, 2016 12:54
Simple script to find all server IPs from OVH panel site and print ready to use Docker Swarm inventory file
function get_ansible_config(managersCount, managersStartNr, workersStartNr) {
var createAnsibleString = function(name, startNumber){
return function(a, i) {
return name + (i + 1 + (startNumber || 0)) + ' ansible_ssh_host=' + a + ' ansible_ssh_user=ubuntu';
}
};
var addresses = $x('//*[@data-ng-if="ip.ip"]/text()')
.filter(function(a){return a.wholeText.trim() != ""})
.map(function(a) {return a.wholeText.trim()});
var str = "";