This enables simple action buttons per entity in the admin list_view. This was adapted for Django 2.1 and is a bit more general than the original it was forked from.
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
# custom response handler for flask and chromelogger | |
# use chromelogger to log directly to the chorme development console | |
# (see: https://github.com/ccampbell/chromelogger-python) | |
# | |
# put this in your application config | |
if app.debug: | |
import chromelogger as console | |
@app.after_request | |
def chromelogger(response): |
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 ForeignCountMeta(ModelBase): | |
""" | |
Metaclass that adds couter methods for reverse foreign keys of Django models. | |
The methods that will be creates are defined in the models Meta options: | |
class CountedParent(models.Model, metaclass=ForeignCounterMeta): | |
class Meta: | |
counted_fields = { | |
"child1_count": {'relation_name': 'child1', 'short_description': 'Child 1 count'}, |
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
ko.bindingHandlers.slideToggleVisible = { | |
init: function(element, valueAccessor) { | |
var value = valueAccessor(); | |
ko.unwrap(value) ? $(element).show() : $(element).hide(); | |
}, | |
update: function(element, valueAccessor) { | |
var value = valueAccessor(); | |
ko.unwrap(value) ? $(element).slideDown() : $(element).slideUp(); | |
} | |
}; |
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.shortcuts import render_to_response | |
from social.backends.oauth import BaseOAuth2 | |
from social.pipeline.partial import partial | |
@partial | |
def pick_character_name(backend, details, response, is_new=False, *args, **kwargs): | |
if backend.name == 'battlenet-oauth2' and is_new: | |
data = backend.strategy.request_data() | |
if data.get('character_name') is None: |
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
/* | |
Can be used to implement star ratings. | |
HTML: | |
<div data-rating data-value="0..5"></div> | |
emits 'ratingChanged' if a star was clicked | |
updates stars if 'changeComplete' event is received. | |
CSS: |
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 datetime import datetime | |
import exifread | |
import pywintypes | |
import win32con | |
import win32file | |
import os | |
from pytz import timezone | |
LOCAL_TZ = timezone('Europe/Berlin') |
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
@-moz-document domain(twitter.com) { | |
div.DMAvatar.u-chromeOverflowFix { | |
border-radius: 5px !important; | |
} | |
.avatar, .Avatar, .nav .session .dropdown-toggle, .EdgeButton, .EdgeButton:visited, .global-nav .search-input, .avatar--circular { | |
border-radius: 5px !important; | |
} | |
.ProfileCard-avatarLink, .ProfileCard-avatarImage, .DashboardProfileCard-avatarImage { |
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
#!/bin/bash | |
SYSTEMS = ("testDNS", "productionDNS", "integrationDNS", "testVPN", "productionVPN", "integrationVPN") | |
IP_ADDR = ("172.16.47.11", "10.0.47.11", "192.168.47.11", "172.16.13.37", "10.0.13.37", "192.168.13.37") | |
for INDEX in ${!SYSTEMS[@]}; do | |
echo Testing: ${SYSTEMS[INDEX]} Address: ${IP_ADDR[INDEX]} | |
snmpwalk -v -2c -c community ${IP_ADDR[INDEX]} UCD-SNMP-MIB:laLoad.1 | |
echo | |
done |
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
pipeline { | |
agent any | |
stages { | |
stage('SmokeTest'){ | |
parallel{ | |
stage('SmokeTest ProdEnv') { | |
steps { | |
echo 'Sanity Testing Production Environment', | |
build job: 'smoke test', |
OlderNewer