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 / django-test-i18n-shell.md
Created July 31, 2021 22:30
Django - test i18n language using shell
  • Use the following commands, replacing your string here with the string that you want to test.
  • Obs.: shell_plus is provided by django-extensions
python manage.py shell_plus
from django.utils.translation import activate, get_language_info, ugettext as _
get_language_info('fr')
activate('fr')
print(_("your string here"))
@andreibosco
andreibosco / CUDA-compute-fix.patch
Last active July 30, 2021 16:24
Caffee CUDA compute fix
--- cmake/Cuda.cmake 2021-07-30 12:07:44.707798734 -0400
+++ cmake/Cuda.cmake.fixed 2021-07-30 12:22:30.551329548 -0400
@@ -4,7 +4,7 @@
# Known NVIDIA GPU achitectures Caffe can be compiled for.
# This list will be used for CUDA_ARCH_NAME = All option
-set(Caffe_known_gpu_archs "20 21(20) 30 35 50 60 61")
+set(Caffe_known_gpu_archs "30 35 50 60 61")
################################################################################################
@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