This file contains hidden or 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/env python3 | |
| import csv | |
| import sys | |
| from pathlib import Path | |
| from collections import Counter | |
| from email.parser import BytesParser | |
| from email import policy | |
| from email.utils import parseaddr | |
| if len(sys.argv) != 2: |
This file contains hidden or 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 random | |
| def coin_toss(): | |
| n = int( | |
| input( | |
| 'Enter number of coin tosses (must be an integer greater than 0): ' | |
| )) | |
| options = ['Option 1', 'Option 2'] | |
| options[0] = input('Enter option 1: ') |
This file contains hidden or 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 pandas as pd | |
| def create_sql_create_statements(df: pd.DataFrame, table_name: str) -> str: | |
| dtype_mapping = { | |
| pd.Series({'a': '3'}).dtype: 'TEXT', | |
| pd.Series({'a': 3}).dtype: 'INT', | |
| pd.Series({'a': 3.0}).dtype: 'FLOAT', | |
| pd.Series({'a': pd.to_datetime('2021-12-3')}).dtype: 'TIMESTAMP' | |
| } | |
| create_statement_string = f'CREATE TABLE {table_name} (\n' |
This file contains hidden or 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
| execute_checks() { | |
| local cask=$1 | |
| brew audit --cask --online "$cask" | |
| brew style --fix "$cask" | |
| brew audit --cask --new "$cask" | |
| HOMEBREW_NO_INSTALL_FROM_API=1 brew install --cask "$cask" | |
| brew uninstall --cask "$cask" | |
| } | |
| read -p "Enter the cask name: " cask |
This file contains hidden or 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 datetime | |
| import pytz | |
| from github import Github | |
| from github.GithubException import GithubException | |
| def cleanup_inactive_forks(github_token, username, repos_to_delete, inactive_days=30): | |
| """ | |
| Remove GitHub forks that haven't been updated in the past month. |
This file contains hidden or 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 sumy.parsers.plaintext import PlaintextParser | |
| from sumy.nlp.tokenizers import Tokenizer | |
| from sumy.summarizers.lsa import LsaSummarizer | |
| with open('transcript.txt') as in_file: | |
| text = in_file.read() | |
| parser = PlaintextParser.from_string(text, Tokenizer("english")) | |
| summarizer = LsaSummarizer() | |
| num_sentences = 13 |
This file contains hidden or 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
| # Install brew if not already installed | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| # Install the JSON processing command line utility | |
| brew install jq | |
| # List workflow runs for a repository | |
| runs=$(gh api \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ |
This file contains hidden or 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
| const displayErrors = (isEmailError, isPasswordError) => { | |
| if (isEmailError) { | |
| return ( | |
| <FormErrorMessage data-testid={testids.login.error.email}> | |
| Email is required. | |
| </FormErrorMessage> | |
| ); | |
| } | |
| if (isPasswordError) { | |
| return ( |
This file contains hidden or 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
| beforeAll(() => { | |
| console.log("This statement will get executed before all the test cases"); | |
| }); | |
| afterAll(() => { | |
| console.log("This statement will get executed after all the test cases"); | |
| }); | |
| describe("test suite", () => { | |
| beforeEach(() => { |
This file contains hidden or 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
| /* | |
| * Unfollow All for Twitter | |
| * | |
| * Go to https://twitter.com/<YourUserName>/following and run the | |
| * below code in the console to gradually unfollow all accounts | |
| * you are following, this should play nice with any rate limiting. | |
| * Built on current Firefox (2021-08-26) though may work for others. | |
| * | |
| * Author: https://twitter.com/OatyCreates | |
| * Copyright 2021-Present @oatycreates |
NewerOlder