Searching for a text in all the history of the repo.
function grep_git_history() {
local term="${@}"
git grep -e "${term}" $(git log -S "${term}" --pretty=format:"%H")
}
grep_git_history 'var = 1'
grep_git_history '{% url'
function grep_git_history() {
local term="${@}"
git grep -e "${term}" $(git log -S "${term}" --pretty=format:"%H")
}
grep_git_history 'var = 1'
grep_git_history '{% url'
#!/usr/bin/env bash | |
catch_kill() { | |
echo "Caught SIGKILL signal!" | |
kill -KILL "$pid" 2>/dev/null | |
} | |
catch_term() { | |
echo "Caught SIGTERM signal!" | |
kill -TERM "$pid" 2>/dev/null |
function password_encode(password) | |
local bcrypt = require 'bcrypt' | |
return bcrypt.digest(password, 12) | |
end | |
function check_password(password, encoded_password) | |
local bcrypt = require 'bcrypt' | |
return bcrypt.verify(password, encoded_password) | |
end |
from .models import Post, Category | |
from .decorators import action_form | |
class PostCategoryForm(forms.Form): | |
title = 'Update category for the selected posts' | |
myfile = forms.FileField() | |
category = forms.ModelChoiceField(queryset=Category.objects.all()) | |
""" | |
Requeriments: | |
$ sudo pip install boto dnspython | |
Edit ~/.boto to use your AWS credentials | |
""" | |
import time | |
import sys |
This util manage to load django settings from a config file that contain sensitive information such as cache, database and project passwords/secrets.
The util also check the permissions file to be safe, and the existence of the SECRET_KEY variable, if no file is found it will automatically create a file with a random SECRET_KEY value.
Add the method load_environment_file
into your code, an use it in your django
import axios from "axios"; | |
const singleton = Symbol(); | |
const singletonEnforcer = Symbol(); | |
function readCookie(name) { | |
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); | |
return (match ? decodeURIComponent(match[3]) : null); | |
} |
matches: | |
- trigger: "!today" | |
replace: "{{mydate}}" | |
vars: | |
- name: mydate | |
type: date | |
params: | |
format: "%d/%m/%Y" | |
- trigger: "!now" |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Tail </title> | |
<style> | |
body {font-family: monospace;} | |
p{ margin: 0;} | |
ul{padding: 0;} |
{"name": "worker", "level": "INFO", "message": "Service start", "timestamp": "2023-04-05 14:04:48.974687279", "ip": "172.17.0.2", "pid": 7}
{"name": "worker", "level": "INFO", "message": "ping", "timestamp": "2023-04-05 14:04:48.975945036", "ip": "172.17.0.2", "pid": 7}
{"name": "worker", "level": "INFO", "message": "Received signal: SIGTERM", "timestamp": "2023-04-05 14:04:53.979013322", "ip": "172.17.0.2", "pid": 7}
{"name": "worker", "level": "INFO", "message": "Stopping", "timestamp": "2023-04-05 14:04:53.980930837", "ip": "172.17.0.2", "pid": 7}