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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
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
>>> import pstats | |
>>> p = pstats.Stats('p.1258156459.52174278XcQE.prof') | |
>>> p.strip_dirs().sort_stats(-1).print_stats(5) | |
Fri Nov 13 15:54:20 2009 p.1258156459.52174278XcQE.prof | |
124278 function calls (122386 primitive calls) in 0.589 CPU seconds | |
Ordered by: standard name | |
List reduced from 1014 to 5 due to restriction <5> |
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
# ------------------------------------------------ | |
# Config files are located in /etc/wireguard/wg0 | |
# ------------------------------------------------ | |
# ---------- Server Config ---------- | |
[Interface] | |
Address = 10.10.0.1/24 # IPV4 CIDR | |
Address = fd86:ea04:1111::1/64 # IPV6 CIDR | |
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started | |
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown |
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
# | |
# This is a yaml version of the stubby configuration file (it replaces the | |
# json based stubby.conf file used in earlier versions of getdns/stubby). | |
# | |
# For more information see | |
# https://dnsprivacy.org/wiki/display/DP/Configuring+Stubby | |
# | |
# This format does not fully support all yaml features - the restrictions are: | |
# - the outer-most data structure must be a yaml mapping | |
# - mapping keys must be yaml scalars |
You can use ffmpeg to directly pull frames off of a dahua 4300s at full resolution. May be a good alternative to pricey dvrs which likely cannot record at full resolution, may not work with the camera, or are prohibitevly expensive
Simple stream to file. Full resolution
ffmpeg -loglevel debug -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/live" \
-c copy -map 0 foo.mp4
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
{ | |
"id": "tx_[transaction-id]", | |
"created": "2017-07-24T05:45:49.311Z", | |
"description": "TFL.GOV.UK/CP\\VICTORIA STREET\\TFL TRAVEL CH\\SW1H 0TL GBR", | |
"amount": -770, | |
"currency": "GBP", | |
"merchant": null, | |
"notes": "", | |
"metadata": { | |
"mastercard_clearing_message_id": "mcclearingmsg_[mastercard-clearing-message-id]", |
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.db.models import fields as django_fields | |
class FilteredModelViewSetMixin(object): | |
""" | |
A mixin providing the possibility to filter the queryset based on | |
query parameters. | |
The mixin overrides the ``get_queryset`` method to return the original | |
queryset additionally filtered based on the query string parameters. |
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
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26 | |
# Only reposting to avoid loosing it. | |
""" | |
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin. | |
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction. | |
""" | |
### pizza/models.py ### |
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 requests_oauthlib import OAuth2Session | |
from flask import Flask, request, redirect, session, url_for | |
from flask.json import jsonify | |
import os | |
app = Flask(__name__) | |
# This information is obtained upon registration of a new GitHub | |
client_id = "<your client key>" |
NewerOlder