Skip to content

Instantly share code, notes, and snippets.

View andreibosco's full-sized avatar

Andrei Bosco B. Torres andreibosco

View GitHub Profile
@andreibosco
andreibosco / decorators.py
Created July 29, 2021 17:32 — forked from canokay/decorators.py
Django Custom View Decorators
from django.http import HttpResponseRedirect
from django.core.exceptions import PermissionDenied
from django.urls import reverse
from django.shortcuts import render
from django.shortcuts import redirect
def role_required(allowed_roles=[]):
def decorator(view_func):
def wrap(request, *args, **kwargs):
@andreibosco
andreibosco / test_smtp_tls_telnet.md
Created May 10, 2021 17:17
Testing SMTP authentication with TLS using telnet
@andreibosco
andreibosco / set_env.md
Created May 6, 2021 15:08
Set environment variables from file of key/value pairs
@andreibosco
andreibosco / powershell-google-tts.PS1
Created March 18, 2021 19:21
Powershell script to generate audio using google text-to-speech service
# Requirements:
# - active google cloud project
# - enable 'Cloud Text-to-Speech API'
# - GOOGLE_APPLICATION_CREDENTIALS defined as an environment variable, pointing to your JSON account key file
# - Google Cloud SDK installed and initialized
# Based on official quickstart example: https://cloud.google.com/text-to-speech/docs/quickstart-protocol
$dialogue = Read-Host -Prompt 'Dialogue text'
$outputName = Read-Host -Prompt 'Output file name (.mp3 extension will be added automatically)'
@andreibosco
andreibosco / unreal_derived_data_cache.md
Created February 8, 2021 16:22
Unreal derived data cache
@andreibosco
andreibosco / yubikey-server.md
Last active October 25, 2022 10:09
Configure linux ssh to use yubikey authentication
@andreibosco
andreibosco / bookmark.min.js
Created July 14, 2020 16:36 — forked from zaydek-old/bookmark.min.js
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@andreibosco
andreibosco / yubikey-windows10.md
Last active August 25, 2023 09:19
Setting up Yubikey with SSH and Git on Windows 10 + Powershell
@andreibosco
andreibosco / .flake8
Last active May 16, 2020 21:50
Python/django stuff
# flake8 with black, import-order, bugbear, bandit
[flake8]
select = B,B9,BLK,C,E,F,I,W
ignore = E203,E501,W503
max-line-length = 80
max-complexity = 10
import-order-style = google
application-import-names = app1,app2 #your applications name here