Skip to content

Instantly share code, notes, and snippets.

import hashlib
from Crypto import Random
from Crypto.Cipher import AES
from base64 import b64encode, b64decode
class AESCipher(object):
def __init__(self, key):
self.block_size = AES.block_size
self.key = hashlib.sha256(key.encode()).digest()
@staticmethod
def __unpad(plain_text):
last_character = plain_text[len(plain_text) - 1:]
bytes_to_remove = ord(last_character)
return plain_text[:-bytes_to_remove]
name: CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
def __scrap_tweets(self):
try:
sleep(2)
tweets = self.driver.find_elements_by_xpath("//article[@role=\"article\"]")
for tweet in tweets:
author = tweet.find_element_by_xpath(".//div[@dir=\"ltr\"]").text
text = tweet.find_element_by_xpath(".//div[@class=\"css-901oao r-hkyrab r-1qd0xha r-a023e6 r-16dba41 "
"r-ad9z0x r-bcqeeo r-bnwqim r-qvutc0\"]").text
data = tweet.find_elements_by_xpath(".//div[@class=\"css-1dbjc4n r-xoduu5 r-1udh08x\"]")
time = tweet.find_element_by_xpath(".//time").get_attribute("datetime")
name: CI/CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
import unittest
from prime import is_prime
class Tests(unittest.TestCase):
def test_1(self):
"""Check that 1 is not prime."""
self.assertFalse(is_prime(1))
import math
def is_prime(n):
"""Determines if a non-negative integer is prime."""
if n < 2:
return False
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request: