Skip to content

Instantly share code, notes, and snippets.

View SrChach's full-sized avatar
:octocat:
Building better humans

Ignacio Martínez Ávila SrChach

:octocat:
Building better humans
  • Mediaagility
  • Mexico City, Mexico
View GitHub Profile
@SrChach
SrChach / README.md
Created June 17, 2019 16:46
git_pre_push_hook

Git hooks

Git hooks live into .git/hooks folder in every git repo.

The name of each one tells us when the git hook it's gonna be executed, and the .sample extension in each one prevent its execution.

When we are going to execute a script in some part of git's lifecycle, we need to

  1. Find the file of the part of lifecycle that we need to override
@SrChach
SrChach / test_time.py
Created August 27, 2019 18:33
See time that processes late in various languages
import datetime
begin = datetime.datetime.now()
# Code we want to measure goes here
end = datetime.datetime.now()
time = end - begin
print("\n" * 5, time.seconds , "\n" * 5)
@SrChach
SrChach / retrieve_images.sh
Created October 28, 2019 18:51
G214 shell file for find lost images and move it to main folder
# If you don't set "_usuario" and "_pass" for DB, this script won't work
# constants setted
_usuario=""
_pass=""
_input="images.txt"
_search_in="../Evidencia"
_carpeta_puente="__ejemplo"
_carpeta_salida="../storage/images"
_limit="LIMIT 5"
@SrChach
SrChach / shell.sh
Created November 8, 2019 19:38
useful shell comands
## Este archivo crecerá
# Para "disk usage". Devuelve el espacio en disco que ocupa un archivo o carpeta
du
# Put in there knowledge for conditionals, if/else, find, pipes
@SrChach
SrChach / arrays.js
Created December 26, 2019 21:02
JS snippets
// For searching into an array, by object property
let arr = [
{ name:"string 1", value:"this", other: "that" },
{ name:"string 2", value:"this", other: "that" }
];
let obj = arr.find(o => o.name === 'string 1');
@SrChach
SrChach / README.md
Created November 23, 2020 19:08
Electron - disable CORS problem

Disabling CORS check in an Electron / Quasar App

Sometimes we try to do http requests from Electron to any page and it seems to be blocked by the "Browser engine" that comes with the renderer proccess.

There's one solution

The hack

  1. Change the BrowserWindow security config