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 sqlalchemy.orm.exc import NoResultFound | |
from sqlalchemy.exc import IntegrityError | |
from rates.extensions import db | |
class LoadSingleton: | |
@classmethod | |
def load(cls): | |
id_ = {"id": 1} | |
try: |
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 smtplib, ssl | |
port = 587 # For starttls | |
smtp_server = "smtp.gmail.com" | |
sender_email = "[email protected]" | |
receiver_email = "[email protected]" | |
password = input("Type your password and press enter:") | |
message = """\ | |
Subject: Hi there |
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 | |
# Credits to https://github.com/aruhier/gnome-terminal-colors-solarized | |
# Install ALL themes using this tool https://github.com/Mayccoll/Gogh | |
# You may nedd to install dconf - sudo apt-get install dconf-cli | |
import subprocess | |
import ast | |
import random | |
import os |
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 concurrent.futures import ThreadPoolExecutor | |
from time import sleep | |
def return_after_5_secs(message): | |
sleep(5) | |
return message | |
pool = ThreadPoolExecutor(3) | |
future = pool.submit(return_after_5_secs, ("hello")) |
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 asyncio | |
import datetime | |
import random | |
async def my_sleep_func(): | |
await asyncio.sleep(random.randint(0, 5)) | |
async def display_date(num, loop): |
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
#!/bin/bash | |
echo | |
echo "# arguments called with ----> ${@} " | |
echo "# \$1 ----------------------> $1 " | |
echo "# \$2 ----------------------> $2 " | |
echo "# path to me ---------------> ${0} " | |
echo "# parent path --------------> ${0%/*} " | |
echo "# my name ------------------> ${0##*/} " | |
echo |
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
# One | |
class Singleton: | |
def __new__(cls, *args, **kwargs): | |
if not hasattr(cls, 'instance'): | |
cls.instance = super(Singleton, cls).__new__(cls) | |
return cls.instance | |
a = Singleton() | |
a.prop = "PROP" |
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 smtplib | |
gmail_user = 'user' | |
gmail_password = 'password' | |
sent_from = gmail_user + '@gmail.com' | |
to = ['[email protected]', '[email protected]', '[email protected]'] | |
subject = 'OMG Super Important Message' | |
body = 'Hey, what"s up?\n\n- You' |
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 | |
# -*- coding: utf-8 -*- | |
from urllib.request import urlopen | |
import re | |
import os | |
import subprocess | |
#ipv6 | |
regex = r"(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-" \ |
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
# pip3 install fabric3==1.14.post1 | |
# Usage: fab cmd:'whoami' | |
from fabric.api import * | |
env.hosts = [ | |
'[email protected]', | |
'[email protected]', | |
'[email protected]', | |
] |
NewerOlder