- Never use snake_case for naming anything (ref: see PSR-2)
- Don't use else except in rare appropriate circumstances (ref)
- Never use elseif, probably want switch (ref)
- Always PSR-2 format the PHP code (ref), see Styleci for automatic help
- Don't use "company name" anywhere, it's implied already, like saying "ATM Machine", it's redundant
- No unused variables (ref)
- Don't commit commented out code, just remove it (ref) (regular comments are fine)
- Never use backticks, they can be executed (ref)
- Don't commit dev tool usage such as `consol
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 os, subprocess, json | |
directory = "Z:\plex\movies" | |
if not directory: | |
directory = input("Enter directory: ") | |
for filename in os.listdir(directory): | |
path = os.path.join(directory, filename) | |
cmd = ['ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', path] | |
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) |
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
<?php | |
use Exception; | |
class BaseInvoiceState | |
{ | |
function __construct(public Invoice $invoice) { } | |
function finalize() { throw new Exception(); } |
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 os, re | |
pattern = re.compile(r'https:..www\d+.zippyshare.com/v/\w+/file.html') | |
directory = 'gogs' | |
urls = [] | |
for filename in os.listdir(directory): | |
f = os.path.join(directory, filename) | |
if not os.path.isfile(f): |
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 os | |
import discord | |
from dotenv import load_dotenv | |
load_dotenv() | |
TOKEN = os.getenv('DISCORD_TOKEN') | |
client = discord.Client() | |
@client.event |
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 os, subprocess, json | |
codec = 'h264' # codec to re-encode video to | |
acceptable = ['hevc', 'h264', 'h265', 'libx264'] | |
skipExtensions = ['jpg', 'png', 'gif', 'txt', 'nfo', 'ds_store'] | |
directory = "" | |
# Make sure a directory is chosen | |
if not directory: | |
directory = input("Enter directory: ") |
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 PIL import Image | |
from icrawler.builtin import BingImageCrawler | |
import pygame | |
import os | |
def choose(keyword): | |
for num in range(1, 11): | |
path = "imgs/" + str(num).zfill(6) + ".jpg" | |
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 wmi, win32api, win32process, win32con | |
priorityclasses = [win32process.IDLE_PRIORITY_CLASS, | |
win32process.BELOW_NORMAL_PRIORITY_CLASS, | |
win32process.NORMAL_PRIORITY_CLASS, | |
win32process.ABOVE_NORMAL_PRIORITY_CLASS, | |
win32process.HIGH_PRIORITY_CLASS, | |
win32process.REALTIME_PRIORITY_CLASS] | |
# "Recipe 496767: Set Process Priority In Windows" on ActiveState - http://code.activestate.com/recipes/496767/ |
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
net stop iphlpsvc | |
net stop wscsvc | |
net stop Winmgmt | |
net start Winmgmt | |
net start wscsvc | |
net start iphlpsvc |
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
{ | |
"http_status":200, | |
"stats":{ | |
"responses":{ | |
"showing":2, | |
"total":2, | |
"completed":2 | |
} | |
}, | |
"questions":[ |
NewerOlder