Skip to content

Instantly share code, notes, and snippets.

View corentinbettiol's full-sized avatar

Corentin Bettiol corentinbettiol

View GitHub Profile
@elidickinson
elidickinson / admin.py
Created November 20, 2011 01:16
Using CKEditor with Flatpages
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget
@gregorynicholas
gregorynicholas / .bash_profile
Created January 8, 2013 23:44
autocomplete functionality for python library command line interfaces (CLI): Fabric & Paver.
#!/usr/bin/env bash
. paver_autocomplete
. fabric_autocomplete
@lambdamusic
lambdamusic / Snipplr-50835.py
Created February 7, 2013 21:28
Django: Strip/Remove HTML tags (django utils)
# To strip/remove HTML tags from an existing string we can use the strip_tags function.
# import the strip_tags
from django.utils.html import strip_tags
# simple string with html inside.
html = '<p>paragraph</p>'
print html # will produce: <p>paragraph</p>
stripped = strip_tags(html)
@skwashd
skwashd / pre-commit
Last active February 28, 2024 11:11
Git pre-commit hook that blocks commits for files that contain swear words.
#!/bin/bash -e
#
# Git pre-commit hook that blocks commits for files that contain swear words.
#
# Created by Dave Hall - http://davehall.com.au
# Distributed under the terms of the WTFPL - http://www.wtfpl.net/
#
# Please don't use this fucking script, it is shit!
#
@drhoden
drhoden / getContext.py
Last active December 7, 2023 16:18
Obtain context from within Django custom template filter
"""
What if you suddenly need to have access to the context object from within
certain filters, and it would be costly to alter its syntax? Well, that
just happend to me. Here is my solution.
"""
def get_context(max_depth=4):
"""A simple (and perhaps dangerous) way of obtaining a context. Keep
in mind these shortcomings:
1. There is no guarantee this returns the right 'context'.
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 1, 2024 17:49
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@crittermike
crittermike / wget.sh
Last active March 26, 2024 22:49
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.