Skip to content

Instantly share code, notes, and snippets.

View hackedhead's full-sized avatar
⚙️
Applied Curiosity

Andrew Lindberg hackedhead

⚙️
Applied Curiosity
View GitHub Profile
@pjho
pjho / example.py
Created October 9, 2016 21:08
Wagtail Related Inline Model
from modelcluster.fields import ParentalKey
from wagtail.wagtailcore.models import Page, Orderable
# The Parent/Consuming page
class ExamplePage(Page):
content_panels = Page.content_panels + [
InlinePanel('related_sub_model_label', label="Ui Heading for inline model"),
]
# The abstract class defining the fields. Can be named whatever.
#You need
#curl, wget, node, npm
VERSION=$(curl https://updates.counterplay.co/ | grep duelyst |grep -v staging | grep zip | tail -c 18 | head -c 6)
wget http://downloads.counterplay.co/duelyst/v$VERSION/duelyst-v$VERSION-win32-x64.zip
#remove old stuff
rm -rf Duelyst-linux-x64
#extract it
rm -rf duelyst-v$VERSION
@alexgleason
alexgleason / m2m.py
Last active May 9, 2023 17:49
Many to many relationships in Wagtail
from django.db import models
from wagtail.wagtailsnippets.models import register_snippet
from wagtail.wagtailcore.models import Page
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import InlinePanel
@register_snippet
class Category(models.Model):
@jnovack
jnovack / README.md
Last active April 3, 2024 03:24
Opening up mosh in firewalld using firewall-cmd

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --add-service=mosh --permanent
  3. firewall-cmd --reload

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

@sampsyo
sampsyo / subcommand.py
Created July 3, 2010 17:37
subcommand support for Python's optparse
"""A simple addition to Python's optparse module supporting subcommands
like those found in the svn or hg CLIs.
To use it, instantiate the Subcommand class for every subcommand you
want to support. Each subcommand has a name, aliases, a help message,
and a separate OptionParser instance. Then pass a list of Subcommands
to the constructor of SubcommandsOptionParser to make a subcommand-
aware parser. Calling parse_args on that parser gives you the
subcommand invoked, the subcommand's arguments and options, and the
global options all in one fell swoop. See the smoke test at the bottom