Skip to content

Instantly share code, notes, and snippets.

@evildmp
evildmp / dockerise-for-divio.txt
Last active June 29, 2021 13:47
Files to be changed in order to Dockerise a Django application for deployment on Divio
git@github.com:divio/demosite.git
Dockerfile
===========
FROM python:3.8
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
RUN python manage.py collectstatic --noinput
@levelsio
levelsio / obfuscate.php
Last active May 5, 2023 12:33
WordPress plugin to progressively obfuscate text like MAKEbook.io
/*
--PIETZ OBFUSCATE CODE--
2019-06-01
from MAKEbook.io
Instructions:
1) put this in your functions.php file
2) add this to the post you want to obfuscate, on top
3) [obfuscate]
4) to start obfuscating, add a HTML code or HTML block with <start></start>
@ShantanuJoshi
ShantanuJoshi / compressMe.py
Last active April 29, 2022 18:15
Python Image Compress
#run this in any directory add -v for verbose
#get Pillow (fork of PIL) from pip before running --> pip install Pillow
import os
import sys
from PIL import Image
def compressMe(file, verbose=False):
filepath = os.path.join(os.getcwd(), file)
oldsize = os.stat(filepath).st_size
@jamesbrobb
jamesbrobb / multiform.py
Last active July 4, 2023 18:53 — forked from michelts/gist:1029336
django multiform mixin and view that allows the submission of a) All forms b) Grouped forms c) An individual form
class MultiFormMixin(ContextMixin):
form_classes = {}
prefixes = {}
success_urls = {}
grouped_forms = {}
initial = {}
prefix = None
success_url = None
@tomdyson
tomdyson / getting-started-with-wagtail.md
Last active November 12, 2020 05:47
Getting started with Wagtail

Wagtail tutorial

Thanks to [Serafeim Papastefanos] for authoring this tutorial. Please note that the installation process is in flux; most of the steps here should soon be unnecessary.

[Wagtail] is a new Open Source [Django]-based CMS. In this 20 minute tutorial we will see how you can create a blog from scratch using Wagtail. If you want to see some more examples of usage please take a look at the [wagtaildemo] GitHub project.

To follow this tutorial you will need to have [Python] 2.7 installed with a working version of [pip] and [virtualenv].

Installing the wagtail dependencies

@adrienlachaize
adrienlachaize / gist:8349832
Created January 10, 2014 10:37
Check if the given file is .txt
import mimetypes
def is_txt_file(file):
"""Test if the file is a txt file."""
mime = mimetypes.guess_type(file)
if mime[0] == 'text\plan':
return True
@adrienlachaize
adrienlachaize / gist:8349814
Created January 10, 2014 10:36
Get system os struct.
import struct
def get_os_struct():
"""Get system os struct."""
return str(struct.calcsize('P') * 8)
@aortbals
aortbals / dispatch.py
Last active October 20, 2023 16:09
Synchronize two folders using python.
#! /usr/bin/python
# Dispatch - synchronize two folders
import os
import filecmp
import shutil
from stat import *
class Dispatch:
''' This class represents a synchronization object '''