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
| 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
| #!/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
| 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 python3.6 | |
| from sys import argv, exit | |
| def start_stop(process): | |
| """Starts/Stops a process | |
| It stops the process that is passed to it by killing it's process ID. If no | |
| process ID is found, then the process is started. | |
| """ |
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 | |
| XORG=${1:-/var/log/Xorg.0.log} | |
| HOSTNAME=`hostname -s` | |
| SYSSERIAL=`sudo /usr/sbin/dmidecode -s system-serial-number` | |
| #SHORTSERIAL=${SYSSERIAL%% *} | |
| /usr/bin/awk -F": " ' | |
| BEGIN { | |
| sys="'${HOSTNAME}'"; | |
| sysserial="'${SYSSERIAL}'"; |
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 sys | |
| from os import system | |
| from urllib.parse import unquote | |
| def decode(url): | |
| """Decodes url encoded string""" | |
| return unquote(url) |
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 | |
| me=`whoami` | |
| max=`cat /sys/class/backlight/radeon_bl0/max_brightness` | |
| sudo chown ${me}:${me} /sys/class/backlight/radeon_bl0/brightness | |
| sudo chmod o+x /sys/class/backlight/radeon_bl0/brightness | |
| ls -al /sys/class/backlight/radeon_bl0/brightness | |
| echo ${max} > /sys/class/backlight/radeon_bl0/brightness | |
| sudo chmod 444 /sys/class/backlight/radeon_bl0/brightness | |
| sudo chown root:root /sys/class/backlight/radeon_bl0/brightness |
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
| # linkedin Python Community | |
| # Python the Hard Way, Lesson 20 | |
| # Sample code | |
| from sys import argv | |
| def print_all(f): | |
| print(f.read()) | |
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
| javascript:void((function()%7Bvar%20a,b;b=%22%3C%22+%22html%3E%5Cn%3Cbody%3EPasswords%20in%20this%20page:%3Cp%3E%5Cn%22;(function(c)%7Bvar%20d,e,f,g,h;for(d=0;d%3Cc.length;d++)%7Btry%7Barguments.callee(c.frames[d]);%7Dcatch(i)%7B%7D%7De=c.document.forms;for(f=0;f%3Ce.length;f++)%7Bg=e[f];for(h=0;h%3Cg.length;h++)%7Bif(g[h].type.toLowerCase()==%22password%22)b+=g[h].value+%22%3Cbr%3E%5Cn%22;%7D%7D%7D)(top);b+=%22%3C/body%3E%5Cn%3C/html%3E%5Cn%22;a=window.open(%22%22,%22%22,%22width=200,height=300%22).document;a.open();a.write(b);a.close();%7D)()) |