Skip to content

Instantly share code, notes, and snippets.

View mick-t's full-sized avatar
🎯
Compiling https://www.xkcd.com/303/

Mick T. mick-t

🎯
Compiling https://www.xkcd.com/303/
View GitHub Profile
@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@phred
phred / pedantically_commented_playbook.yml
Last active June 27, 2024 13:39
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@raecoo
raecoo / gist:3064396
Created July 7, 2012 03:45
merge upstream from fork repository
1. git remote add upstream <origin repo>
2. git fetch upstream
3. git merge upstream/master
4. git push
@ndarville
ndarville / secret-key-gen.py
Created August 24, 2012 17:01
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@KartikTalwar
KartikTalwar / Documentation.md
Last active June 25, 2024 10:55
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@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

@jdklub
jdklub / admin.py
Last active November 22, 2023 11:25
Edit a many-to-many relationship (ManyToManyField) on the Django Admin change list page.
class BookChangeList(ChangeList):
def __init__(self, request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin):
super(BookChangeList, self).__init__(request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin)
# these need to be defined here, and not in BookAdmin
@alvagante
alvagante / gist:b8f67647c78590f3e67a
Created October 24, 2014 14:53
Hiera examples for example42/puppet-network
# Single interface with hostname
---
network::hostname: 'host.my.domain'
network::interfaces_hash:
eth0:
ipaddress: 172.17.1.10
broadcast: 172.17.1.255
netmask: 255.255.245.0
gateway: 172.17.1.1
@traumverloren
traumverloren / doorkeeper.rb
Last active March 10, 2022 10:27
doorkeeper config for redirect back to client app after login with oauth2 provider
#########################
# config/initializers/doorkeeper.rb
#########################
Doorkeeper.configure do
# Change the ORM that doorkeeper will use.
# Currently supported options are :active_record, :mongoid2, :mongoid3, :mongo_mapper
orm :active_record
# This block will be called to check whether the resource owner is authenticated or not.