Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@felipem775
felipem775 / non-ascii.sh
Created September 25, 2019 07:28
Busca caracteres fuera del ascii
# Busca caracteres fuera del ascii
find -name '*.py' -print0 |xargs -0 grep -P '[^\x00-\x7f]' > /tmp/non-ascii.txt
@felipem775
felipem775 / settings.json
Created September 2, 2019 11:48
Settings para que VSCode muestre los test de python con la posibilidad de ejecutar en debug
{
"python.pythonPath": "env/bin/python",
"pythonTestExplorer.testFramework": "unittest",
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"test_*.py"
],
@felipem775
felipem775 / goreviewpartner config.ini
Created August 3, 2019 11:15
goreviewpartner config
[General]
language = en
sgffolder = /tmp
rsgffolder =
pngfolder =
livefolder = live_analysis
stonesound =
[Analysis]
maxvariations = 26
from datetime import datetime
import matplotlib.pyplot as plt
fn = "Nivel_Cares_1.csv"
X, Y = [], []
with open(fn) as f:
f.readline() # leer y descartar cabecero
for line in f:
y, x = line.strip().replace(",",".").split(";")
@felipem775
felipem775 / untarFiles.sh
Created October 17, 2018 20:15
untar files in a different path
for filename in *.tar; do
tar -xf "$filename" -C "destino"
done
@felipem775
felipem775 / findMaxValue.js
Created July 31, 2018 10:59
Find the object whose property "X" has the greatest value in an array of objects
// https://stackoverflow.com/questions/4020796/finding-the-max-value-of-an-attribute-in-an-array-of-objects Andy Polhill
var n1 = { dateTime: new Date(), name: "n1"}
var n2 = { dateTime: new Date(), name: "n2"}
data = [n1, n2]
data.reduce(function (prev, current) { return (prev.dateTime > current.dateTime) ? prev : current })
@felipem775
felipem775 / png2mp4
Created June 6, 2018 07:11
convertir imágenes png a vídeo
ffmpeg -framerate 10 -pattern_type glob -i '*.png' -c:v libx264 \
-r 30 -pix_fmt yuv420p out.mp4
-- original https://stackoverflow.com/a/19532132/2428230
CREATE FUNCTION make_uid() RETURNS text AS $$
DECLARE
new_uid text;
done bool;
BEGIN
done := false;
WHILE NOT done LOOP
new_uid := upper(substring(md5(''||now()::text||random()::text),1,8));
done := NOT exists(SELECT 1 FROM report_users WHERE confirm_key=new_uid);