Skip to content

Instantly share code, notes, and snippets.

View skatesham's full-sized avatar
🏠
Working from home

Sham skatesham

🏠
Working from home
View GitHub Profile
@skatesham
skatesham / setupgithub.py
Created September 13, 2018 19:18
Script Set Up Github with Python3 in command line
#! /usr/bin/python
import subprocess
print("---------------------------------------------------")
print("Automatic Watched Set Up of Github in Python")
print("-----------by Sham Vinicius Fiorin-----------------")
print("---------------------------------------------------")
config = input("Set up configurations[N/s]?")
if('s' in config.lower()):
subprocess.run(["git", "init"])
class Mapper:
def convertValue(self, data, obj):
"""
Mapper from dict to class, covering it's chieldrens but the key on dict must be mapping the chield with .
Exemple: data = {
"x": 0,
"y": 1,
"chield.a": "Sham Vinicius",
"chield.b": "Fiorin",
"chield.layer.c": "xxx",
@skatesham
skatesham / bobble_sort.py
Last active October 7, 2020 23:25
Simples bobble_sort Sort Algorithm
import unittest
def bobble_sort(values):
"""
Sorting list algorithm type of BobbleSort.
Time O(n**2 - n)
Space O(n + 3)
:author sham vinicius fiorin
:param values: List of comparable objects
@skatesham
skatesham / overriding_method_polymorphic.py
Last active October 23, 2020 03:07
Polymorphism and Abstract Method Overriding implementing an Interface
from abc import ABC, abstractmethod
def main():
for obj in (LocalFinder(), ExternalFinder()):
obj.explore()
obj.comming_back()
class FinderInterface(ABC):
@skatesham
skatesham / yahtzee-game.py
Last active July 13, 2021 01:08
Yahtzee Game with Python 3 (command line)
import random
# Para versão 2, auxilia na pontução
pontuacao = {
'G': 50,
'Q': 40,
'S+': 30,
'S-': 40,
'T': 20,
'A': "SOMA",
@skatesham
skatesham / gof_chalenge.py
Created November 26, 2021 06:35
Daily chalenge with GOF design pattern with python 3.6+
'''
Daily chalenge with GOF design pattern with python 3.6+
'''
base = [
{
"type": "Creational Design Patterns",
"patterns": [
"Abstract Factory. Allows the creation of objects without specifying their concrete type.",
"Builder. Uses to create complex objects.",
@skatesham
skatesham / gof-server.py
Created November 26, 2021 07:00
Server chalenge gof
from http.server import BaseHTTPRequestHandler, HTTPServer
import time
base = [
{
"type": "Creational Design Patterns",
"patterns": [
"Abstract Factory. Allows the creation of objects without specifying their concrete type.",
"Builder. Uses to create complex objects.",
"Factory Method. Creates objects without specifying the exact class to create.",
@skatesham
skatesham / sena.py
Last active December 27, 2023 16:06
Mega sena script - 6 numbers game paid R$ 4,50 - Best run teh script then start playing
from random import randint
import re
def generate(size):
unique_numbers = list()
while(len(unique_numbers) < size):
new_value = randint(1, 60)
if (new_value not in unique_numbers):
unique_numbers.append(new_value)
@skatesham
skatesham / python-json-to-sqlite3.py
Created August 23, 2022 23:05
Get list json and send to table jsqlite
import json
import sqlite3
connection = sqlite3.connect('db.sqlite')
cursor = connection.cursor()
cursor.execute('Create Table if not exists Student (name Text, course Text, roll Integer)')
traffic = json.load(open('json_file.json'))
@skatesham
skatesham / VeeValidate.vue
Created October 26, 2022 07:00
VeeValidate Hellow World
<script lang="ts">
import { Field, Form, ErrorMessage } from 'vee-validate';
export default {
components: {
Form,
Field,
ErrorMessage
},
methods: {