Skip to content

Instantly share code, notes, and snippets.

View gchacaltana's full-sized avatar
🎯
Focusing

Gonzalo Chacaltana gchacaltana

🎯
Focusing
  • Perú
View GitHub Profile
@gchacaltana
gchacaltana / nginx.conf
Created September 12, 2023 03:40
Add denny access directive email
# Deny all attempts to access hidden files/folders such as .git, .htaccess, .htpasswd, .DS_Store (Mac), etc...
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Deny yaml, twig, markdown, ini file access
location ~* /.+\.(markdown|md|twig|yaml|yml|ini)$ {
deny all;
@gchacaltana
gchacaltana / swagger-ui.html
Created October 15, 2022 07:12
Template Swagger UI for API documentation [OpenAPI v3.0]
<!DOCTYPE html>
<html>
<head>
<title>API Docs with Swagger UI</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css">
</head>
<body>
@gchacaltana
gchacaltana / settings.json
Created September 10, 2022 23:23
Visual Code - Settings - Editor Ruler
{
"editor.rulers": [80,120],
"workbench.colorCustomizations": {
"editorRuler.foreground": "#ff4081"
}
}
@gchacaltana
gchacaltana / .env
Created August 17, 2022 04:44
Archivo .env para proyectos wordpress
#--------------------------------------------------------------------------------------------------#
# ENVIRONMENT SETTING #
# It can be anything, but "development", "staging" and "production" are supported out of the box. #
# Do not use "development" on production and viceversa, because it has effect on debug settings. #
#--------------------------------------------------------------------------------------------------#
WORDPRESS_ENV=development
#--------------------------------------------------------------------------------------------------#
# DEBUG #
# If you set WORDPRESS_ENV, default debug values are used based on that. #
@gchacaltana
gchacaltana / hyper.conf.js
Created May 28, 2022 00:16
Hyper Config File - Example Settings
"use strict";
/*
Example Hyper Config
@link https://hyper.is#cfg for all currently supported options.
*/
module.exports = {
config: {
updateChannel: 'stable',
fontSize: 17,
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
@gchacaltana
gchacaltana / ConfusionMatrix.php
Last active June 17, 2021 05:36
Matriz de confusión binaria
<?php
declare(strict_types = 1);
/**
* ConfusionMatrix
*
* @author Gonzalo Chacaltana Buleje <gchacaltanab@outlook.com>
* @version v1.0.0
* @access public
*/
@gchacaltana
gchacaltana / wordcloud_corpus.R
Created May 16, 2021 07:01
Show worcloud from corpus (R)
# Función que devuelve wordcloud de un contenido de texto
# @param Corpus corpus Example: Corpus(VectorSource(publication)) from Corpus Package
wordcloud_corpus <- function(corpus) {
# Matriz de términos (Term-Document-Matrix)
tdm = TermDocumentMatrix(corpus, control = list(removePunctuation = TRUE, removeNumbers = TRUE, tolower = TRUE))
matrix_tdm = as.matrix(tdm)
# Obtenemos las palabras frecuentes de mayor a menor
words_freqs = sort(rowSums(matrix_tdm), decreasing=TRUE)
@gchacaltana
gchacaltana / custom_theme_ggplot.R
Created December 23, 2020 05:50
Custom theme ggplot
theme_bluewhite <- function (base_size = 11, base_family = "") {
theme_bw() %+replace%
theme(
panel.grid.major = element_line(color = "white"),
panel.background = element_rect(fill = "lightblue"),
panel.border = element_rect(color = "lightblue", fill = NA),
axis.line = element_line(color = "lightblue"),
axis.ticks = element_line(color = "lightblue"),
axis.text = element_text(color = "steelblue")
)
@gchacaltana
gchacaltana / insert_median_min_max_to_chart.js
Created June 21, 2020 16:09
Insert horizontal lines (median, maximum, minimum) to ChartJS chart
var canvas = document.getElementById("myChart");
var ctx = canvas.getContext("2d");
var horizonalLinePlugin = {
afterDraw: function(chartInstance) {
var yScale = chartInstance.scales["y-axis-0"];
var canvas = chartInstance.chart;
var ctx = canvas.ctx;
var index;
var line;