Skip to content

Instantly share code, notes, and snippets.

@Eitol
Eitol / data_grid.py
Last active January 29, 2024 20:41
Simple Data grid for kivy. (Work in python 3 an 2)
import json
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ListProperty
from kivy.uix.label import Label
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.core.window import Window
from kivy.uix.scrollview import ScrollView
@Eitol
Eitol / forming_a_magic_square.py
Created September 7, 2017 03:28
HackerRank "Forming a Magic Square" python solution
import sys
# Solve https://www.hackerrank.com/challenges/magic-square-forming/problem
matrix_list = [[[8, 1, 6], [3, 5, 7], [4, 9, 2]],
[[6, 1, 8], [7, 5, 3], [2, 9, 4]],
[[4, 9, 2], [3, 5, 7], [8, 1, 6]],
[[2, 9, 4], [7, 5, 3], [6, 1, 8]],
[[8, 3, 4], [1, 5, 9], [6, 7, 2]],
[[4, 3, 8], [9, 5, 1], [2, 7, 6]],
[[6, 7, 2], [1, 5, 9], [8, 3, 4]],
@Eitol
Eitol / gist:59751e93bdc1c34e551e9781d993adb2
Created March 29, 2021 18:35
regex - numeros chilenos - con todos los codigos de area .js
export const REGEX_TELEFONO_CHILE = /^(\+?(56))?(([92]\d{8})|(((3[2345])|(4[1235])|(5[123578])|(6[134578])|(7[1235]))\d{7}))$/;
## CONFIG
USR=`whoami`
SHARED_FOLDER=/home/${USR}/NAS
## GO CONFIG
GOVER='1.11.1'
GOPATH=/opt/go
GO_INSTALL_FOLDER=/usr/local/
GOROOT=${GO_INSTALL_FOLDER}/go
@Eitol
Eitol / install_protobuf.sh
Last active November 14, 2018 12:48
Install lastest version of protobuf. Tested in in ubuntu 18.04.
#!/usr/bin/env bash
# run like:
# sudo -S bash ./install_protobuf.sh
#-------- Config ---------
SO=linux-x86_64 # linux-x86_64 | linux-x86_32 | windows | osx
PROTOBUF_REPO="protocolbuffers/protobuf"
PROTOBUF_USER=`whoami`
@Eitol
Eitol / asdasdasd
Last active October 7, 2018 13:19
django cli #django
pip3 install virtualenv
pip install psycopg2-binary
# Iniciar un proyecto
django-admin.py startproject NOMBRE
# La wea que migra
manage.py makemigrations
manage.py migrate
manage.py runserver
@Eitol
Eitol / asdadasdsad
Created October 7, 2018 12:57
run pgadmin #postgres
python3 /usr/local/lib/python3.6/dist-packages/pgadmin4/pgAdmin4.py
@Eitol
Eitol / pytest_mock_example.py
Created April 13, 2018 02:34
mock pytest parametrize test
# first install pip3 install pytest-mock
import os
import pytest
class TestNodeInteractor:
    def exists(self, path):
        return os.path.exists(path)
    @pytest.fixture(autouse=True)
    def mock_exists(self, mocker, expect):
@Eitol
Eitol / install_avrdude_raspbian9.sh
Created March 2, 2018 03:46
Install AVRDUDE in Raspbian 9 (raspberry pi model B)
#!/usr/bin/env bash
sudo apt-get install bison flex libusb-dev gcc gcc-avr avr-libc libelf-dev libusb-1.0-0-dev libusb-1.0-0-dev libftdi1-dev libftdi-dev libhidapi-libusb libevent-pthreads-2.0-5 libpthread-workqueue0 -y
wget http://ftp.nchc.org.tw/Unix/NonGNU/avrdude/avrdude-6.1.tar.gz
tar xfv avrdude-6.2.tar.gz -C /tmp
CURRENT_DIR=$(pwd)
cd /tmp/avrdude-6.2
./configure --enable-linuxgpio
make -j4
sudo make install
sudo apt remove minecraft-pi chromium-browser claws-mail galculator bluej greenfoot geany scratch scratcht2 sense-emu-tools sense-hat libreoffice* wolfram*