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.templatetags.static import StaticNode | |
def patch_static_tag(unique_per_deploy: str): | |
def handle_simple_wrapper(func): | |
def wrapper_func(cls, path): | |
resolved_static_path = func(path) | |
if resolved_static_path.endswith('.js') or resolved_static_path.endswith('.css'): | |
resolved_static_path += f'?u={unique_per_deploy}' | |
return resolved_static_path |
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://registry.platformio.org/platforms/platformio/espressif8266/boards | |
// /homeassistant/esphome/distance_sensor_helper.h | |
#include "esphome.h" | |
// https://esphome.io/components/sensor/custom | |
class DistanceSensorHelper : public PollingComponent, public Sensor { | |
public: | |
int _trigPin; | |
int _echoPin; | |
DistanceSensorHelper(int polling_time) : PollingComponent(polling_time) { |
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://stackoverflow.com/questions/7499767/temporarily-disable-auto-now-auto-now-add | |
""" | |
Con modifcacion de Georgina S | |
n.b. (1.10) ModelClass._meta.get_field_by_name(field_name)[0] in do_to_model didn't seem to be working for me - changed to: ModelClass._meta.get_field(field_name) – | |
Georgina S | |
Commented Mar 8, 2017 at 1:15 | |
""" | |
def turn_off_auto_now(ModelClass, field_name): | |
def auto_now_off(field): |
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.template.defaultfilters import title | |
class LabelToTitle: | |
def __init__(self): | |
self.label = title(self.label) | |
class FooBarModelChoiceField(forms.ModelChoiceField, LabelToTitle): | |
def label_from_instance(self, obj): |
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
alias reload_gunicorn='pidof -x gunicorn|xargs sudo kill -s HUP' | |
$ inotifywait -m -e modify,create,delete -r . && reload_gunicorn |
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
<html> | |
<body> | |
<style> | |
.btn-check:checked + label:before { | |
content: "✓"; | |
left: 3px; | |
position: absolute; | |
} | |
</style> | |
<div class="col-md-6"> |
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 GetSVGDot extends Function{ | |
dot_svgs = []; | |
constructor(size) { | |
super('return arguments.callee._call.apply(arguments.callee, arguments)'); | |
const dot_colors = ['#FF0000', '#FF8000', '#80FF00', '#000000', '#0000FF', '#0000FF', '#FFFF00', '#FF6600', '#00FF00', '#00FFFF', '#FF00FF', '#8000FF', '#6600FF', '#FF7D00']; | |
let cont = 0; | |
for(const dot_color of dot_colors) { | |
this.dot_svgs.push(`<svg id='svg_circle_${cont}' width='${size}' height='${size}'> | |
<circle cx="12.5" cy="12.5" r="6.25" fill="${dot_color}"> | |
</circle> |
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://github.com/ohmyzsh/ohmyzsh/issues/10175 | |
DISABLE_UNTRACKED_FILES_DIRTY="true" in .zshrc | |
git config --global --add oh-my-zsh.hide-status 1 | |
git config --global --add oh-my-zsh.hide-dirty 1 |
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
First, the server | |
docker run -d --name sonarqube -p 8000:8000 -p 9000:9000 sonarqube:8.9.6-community | |
Then login with admin:admin | |
http://127.0.0.1:9000 | |
Create the project and its token | |
An example for running the scanner with docker |
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
sudo cat /var/log/audit/audit.log | audit2why |
NewerOlder