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 getpass import getpass | |
| from functools import wraps | |
| from os import system | |
| from passlib.hash import pbkdf2_sha512 | |
| def hashit(func): | |
| """Decorator to securely hash passwords""" | |
| @wraps(func) # preserves function meta data |
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 bash | |
| # it won't stay in the virtual env so you will | |
| # have to activate the environment by hand: | |
| # | |
| # source venv/bin/activate | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| if [ -f "requirements.txt" ]; then |
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 requests | |
| from bs4 import BeautifulSoup | |
| URL = "http://store.steampowered.com/feeds/newreleases.xml" | |
| FILE = 'newreleases.xml' | |
| USE_LOCAL = False | |
| def read_file(): |
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
| """Written on iPhone with the Pythonista 3 app | |
| As a joke for the PyBites guys, I don't see why it wouldn't work anywhere else though. They always | |
| start off their newsletter annoucements with: | |
| from @PyBites import newsletter | |
| So I turned it into actual code that pulls their feed and opens their latest newsletter in a browser :) | |
| """ | |
| import os |
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
| #!/bin/bash | |
| sudo dmidecode | awk '/^Memory\ Device$/,/Size/{if ($0~/Size/)print}' |
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
| #!/bin/bash | |
| echo $(ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $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
| # secret message code challenge | |
| # https://dev.to/rpalo/secret-message-7do | |
| from string import ascii_lowercase | |
| from long_string import code | |
| ALPHA = ascii_lowercase + '_' | |
| def count(letters): | |
| counts = {} | |
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
| #!/bin/bash | |
| ps awxx | grep $1 | grep -v get_pid | grep -v grep | awk '{print $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
| def check_value(value): | |
| """ | |
| Validates the value that was passed into the program. | |
| :param value: A positive integer is the only valid value | |
| :return: int or an exception is raised | |
| """ | |
| if isinstance(value, bool): | |
| raise ValueError | |
| elif isinstance(value, str): |
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 os import system, name | |
| from time import sleep | |
| from console import clear | |
| # art from https://codereview.stackexchange.com/questions/101968/hangman-with-ascii | |
| ascii_art = (""" | |
| _________ | |
| |/ | |
| | |