This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonFieldErrors: | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.non_field_errors = [] | |
self.meta.form_template = 'struct.html' | |
def get_form_context(self, value, prefix='', errors=None): | |
context = super().get_form_context(value, prefix, errors) | |
context['non_field_errors'] = self.non_field_errors | |
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pico-8 cartridge // http://www.pico-8.com | |
version 16 | |
__lua__ | |
line_weight = 1 | |
border_colour = 7 | |
up = 2 | |
right = 1 | |
down = 3 | |
left = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.djangoproject.com/en/2.0/topics/http/urls/#including-other-urlconfs | |
from django.urls import include, path | |
from . import views | |
# Change this | |
urlpatterns = [ | |
path('<page_slug>-<page_id>/history/', views.history), | |
path('<page_slug>-<page_id>/edit/', views.edit), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prerequisites | |
# | |
# - npm install -g hcron | |
import subprocess | |
cron_input = open('cron.input.txt') | |
cron_output = open('cron.output.txt', 'w') | |
for line in cron_input.readlines(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def chunks(generator, chunk_size): | |
"""Yield successive chunks from a generator""" | |
chunk = [] | |
for item in generator: | |
if len(chunk) >= chunk_size: | |
yield chunk | |
chunk = [item] | |
else: | |
chunk.append(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net" | |
"os" | |
"log" | |
"fmt" | |
"io" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
telnet 0.0.0.0 1025 | |
Trying 0.0.0.0... | |
Connected to 0.0.0.0. | |
Escape character is '^]'. | |
220 mailhog.example ESMTP MailHog | |
helo localhost | |
250 Hello localhost | |
mail from: <[email protected]> | |
250 Sender [email protected] ok | |
rcpt to: <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git branch | while read BRANCH ; do | |
git checkout $BRANCH &> /dev/null; | |
LINE_COUNT=`wc -l $(git ls-files | grep "\(.html\|.py\)$") | tail -n 1` | |
echo "$LINE_COUNT $BRANCH" | |
done | sort -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.servers.basehttp import WSGIRequestHandler | |
# Grab the original log_message method. | |
_log_message = WSGIRequestHandler.log_message | |
def log_message(self, *args): | |
# Don't log if path starts with /static/ | |
if self.path.startswith("/static/"): | |
return | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { | |
var adjectives = [ | |
"Autumn", "Hidden", "Bitter", "Misty", "Silent", "Empty", "Dry", "Dark", "Summer", "Icy", | |
"Delicate", "Quiet", "White", "Cool", "Spring", "Winter", "Patient", "Twilight", "Dawn", | |
"Crimson", "Wispy", "Weathered", "Blue", "Billowing", "Broken", "Cold", "Damp", "Falling", | |
"Frosty", "Green", "Long", "Late", "Lingering", "Bold", "Little", "Morning", "Muddy", "Old", | |
"Red", "Rough", "Still", "Small", "Sparkling", "Wandering", "Withered", "Wild", "Black", | |
"Young", "Holy", "Solitary", "Fragrant", "Aged", "Snowy", "Proud", "Floral", "Restless", | |
"Divine", "Polished", "Ancient", "Purple", "Lively", "Nameless"]; | |
var nouns = [ |