This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
""" Demonstrating APScheduler feature for small Flask App. """ | |
from apscheduler.schedulers.background import BackgroundScheduler | |
from flask import Flask | |
def sensor(): | |
""" Function for test purposes. """ | |
print("Scheduler is alive!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NPRODUCTO | CONCURSO | F1 | F2 | F3 | F4 | F5 | F6 | F7 | BOLSA | FECHA | |
---|---|---|---|---|---|---|---|---|---|---|---|
30 | 1398 | 6 | 9 | 26 | 31 | 34 | 37 | 32 | 19300000 | 10/02/2024 | |
30 | 1397 | 1 | 5 | 12 | 14 | 26 | 31 | 37 | 17300000 | 06/02/2024 | |
30 | 1396 | 4 | 8 | 20 | 29 | 30 | 35 | 14 | 14700000 | 03/02/2024 | |
30 | 1395 | 5 | 8 | 17 | 29 | 38 | 39 | 19 | 12700000 | 30/01/2024 | |
30 | 1394 | 6 | 8 | 26 | 28 | 31 | 33 | 20 | 10700000 | 27/01/2024 | |
30 | 1393 | 2 | 3 | 18 | 23 | 28 | 29 | 12 | 8900000 | 23/01/2024 | |
30 | 1392 | 2 | 6 | 20 | 26 | 30 | 32 | 5 | 7300000 | 20/01/2024 | |
30 | 1391 | 8 | 12 | 14 | 16 | 19 | 29 | 25 | 5700000 | 16/01/2024 | |
30 | 1390 | 7 | 10 | 18 | 19 | 24 | 25 | 13 | 5200000 | 13/01/2024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NPRODUCTO | CONCURSO | R1 | R2 | R3 | R4 | R5 | FECHA | Multiplicador | |
---|---|---|---|---|---|---|---|---|---|
60 | 31787 | 5 | 5 | 7 | 5 | 1 | 18/01/2024 | NO | |
60 | 31786 | 3 | 1 | 8 | 2 | 8 | 18/01/2024 | NO | |
60 | 31785 | 4 | 7 | 0 | 8 | 0 | 18/01/2024 | NO | |
60 | 31784 | 4 | 9 | 9 | 2 | 3 | 18/01/2024 | NO | |
60 | 31783 | 5 | 7 | 3 | 0 | 4 | 18/01/2024 | SI | |
60 | 31782 | 4 | 8 | 5 | 1 | 3 | 17/01/2024 | SI | |
60 | 31781 | 1 | 6 | 3 | 0 | 7 | 17/01/2024 | NO | |
60 | 31780 | 5 | 0 | 5 | 5 | 9 | 17/01/2024 | NO | |
60 | 31779 | 8 | 4 | 8 | 2 | 9 | 17/01/2024 | NO |
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 9 columns, instead of 2. in line 8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index,Organization Id,Name,Website,Country,Description,Founded,Industry,Number of employees | |
1,FAB0d41d5b5d22c,Ferrell LLC,https://price.net/,Papua New Guinea,Horizontal empowering knowledgebase,1990,Plastics,3498 | |
2,6A7EdDEA9FaDC52,"Mckinney, Riley and Day",http://www.hall-buchanan.info/,Finland,User-centric system-worthy leverage,2015,Glass / Ceramics / Concrete,4952 | |
3,0bFED1ADAE4bcC1,Hester Ltd,http://sullivan-reed.com/,China,Switchable scalable moratorium,1971,Public Safety,5287 | |
4,2bFC1Be8a4ce42f,Holder-Sellers,https://becker.com/,Turkmenistan,De-engineered systemic artificial intelligence,2004,Automotive,921 | |
5,9eE8A6a4Eb96C24,Mayer Group,http://www.brewer.com/,Mauritius,Synchronized needs-based challenge,1991,Transportation,7870 | |
6,cC757116fe1C085,Henry-Thompson,http://morse.net/,Bahamas,Face-to-face well-modulated customer loyalty,1992,Primary / Secondary Education,4914 | |
7,219233e8aFF1BC3,Hansen-Everett,https://www.kidd.org/,Pakistan,Seamless disintermediate collaboration,2018,Publishing Industry,7832 | |
8,ccc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Function which will update 'updated_at' columnd of any table that has it. | |
CREATE OR REPLACE FUNCTION trigger_set_timestamp() | |
RETURNS TRIGGER AS $$ | |
BEGIN | |
NEW.updated_at = NOW(); | |
RETURN NEW; | |
END; | |
$$ LANGUAGE plpgsql; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example data, used for Docke Container environment. | |
DATABASE_USERNAME='postgres' | |
DATABASE_PASSWORD='postgres' | |
DATABASE_IP='172.17.0.2' | |
DATABASE_PORT='5432' | |
DATABASE_NAME='postgres' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
print("Operating System: ", os.uname().sysname) | |
print("\nTime in UTC since Unix time epoch (1970-01-01 00:00:00).") | |
print("As seconds: ", time.time()) | |
print("As string: ", time.ctime()) | |
print("Seconds in the future: ", time.ctime(2065944467)) | |
print("One second behind epoch: ", time.ctime(-1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
from ipaddress import ip_network | |
import random | |
filename = 'fake_access.log' | |
number_of_lines = 20 | |
ips = list(ip_network('123.25.44.0/28').hosts()) | |
ips += list(ip_network('25.1.4.128/28').hosts()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python3 -m timeit "'foo' + 'bar'" | |
50000000 loops, best of 5: 5.31 nsec per loop |
NewerOlder