This guide explains how to set up Kerberos authentication for:
- SSH access to a server,
- HTTP access to a service.
It assumes you're running Active Directory and Debian servers.
import logging | |
logger = logging.getLogger('django.db.backends') | |
logger.setLevel(logging.DEBUG) | |
logger.addHandler(logging.StreamHandler()) |
// Pagination is done on the client-side. Remove it. | |
document.querySelectorAll('tr[id^="ligne"]').forEach(tr => { tr.style.removeProperty("display") }); | |
// There is a 30s mandatory wait between each click. Click one link every 40s. | |
var delay = 10; | |
document.querySelectorAll('tr[id^="ligne"] a[href*="ouvreTelechargement"]').forEach(a => { | |
var tr = a.closest('tr'); | |
if (tr.querySelector('.imgbam-picto-nouveau') !== null) { | |
setTimeout(() => { | |
tr.style.setProperty("background-color", "chartreuse"); |
Scroll to the bottom for the answer
Question
There's two ways to increase the default font size in browsers:
Option 1 relies on the browser's proportional scaling. This feature was
"""Convert datetimes in the database when switching USE_TZ from False to True. | |
tl;dr RUNNING THIS SCRIPT CAN RESULT IN DATA CORRUPTION, DATA LOSS AND EVEN | |
SERVER CRASHES. USE IT AT YOUR OWN RISK. NO WARRANTY WHATSOEVER. | |
This is a management command. Put it in the management.commands package of | |
one of your applications, then run: ./manage.py convert_to_utc <app_name> ... | |
This script assumes that no write operations take place while it's running. | |
It will rewrite every single record in your database; that's its whole point. |
from django.contrib import admin | |
class ReadOnlyModelAdmin(admin.ModelAdmin): | |
""" | |
ModelAdmin class that prevents modifications through the admin. | |
The changelist and the detail view work, but a 403 is returned | |
if one actually tries to edit an object. |
#!/usr/bin/env python3.8 | |
""" | |
To enable this service, copy this file to /opt, then: | |
# chmod +x /opt/powermate.py | |
# pip3.8 install websockets | |
# cat > /etc/systemd/system/powermate.service | |
[Unit] | |
Description=PowerMate |
#!/usr/bin/env python | |
""" | |
Locate and remove unreferenced media files. | |
Expects DJANGO_SETTINGS_MODULE to be set in the environment. | |
""" | |
import collections |
Install and register the FreeTDS driver for unixODBC.
apt-get install tdsodbc
odbcinst -i -d -f /usr/share/tdsodbc/odbcinst.ini
(Optional) Test the DSN-less connection with pyodbc.
apt-get install python-pyodbc
>>> import pyodbc
#!/usr/bin/env python | |
import getpass | |
import json | |
import pickle | |
import subprocess | |
import sys | |
import time | |
import zlib |