Guides for setting up a Linux computer to play video games in emulators.
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
extension String { | |
var formattedForPlex: String { | |
var newName = self | |
// Remove all text at the end | |
let regexEndText = "\\d{3,4}p.+" | |
if let range = newName.range(of: regexEndText, options: .regularExpression) { | |
newName.removeSubrange(range) | |
} | |
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 tweepy # pip3 install tweepy | |
import json | |
from datetime import datetime, timedelta, timezone | |
CONSUMER_KEY = "**********" | |
CONSUMER_SECRET = "**********" | |
def oauthLogin(consumerKey, consumerSecret): | |
auth = tweepy.OAuthHandler(consumerKey, consumerSecret) | |
authURL = auth.get_authorization_url() |
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
if [[ -d "$1" ]]; then | |
for file in "$1"/**/*(.); do | |
ext="${file##*.}" | |
if [[ $ext == "mkv" ]] || [[ $ext == "mp4" ]] || [[ $ext == "avi" ]]; then | |
transcode "$file" | |
fi | |
done | |
trash "$1" |
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
extension Array { | |
func combine(_ numberOfElements: Int) -> [[Element]] { | |
guard numberOfElements > 0 else { return [.init()] } | |
guard let first = first else { return [] } | |
return Array(dropFirst()) | |
.combine(numberOfElements - 1) | |
.map { [first] + $0 } + | |
Array(dropFirst()) | |
.combine(numberOfElements) |
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 SwiftUI | |
extension View { | |
func wiggling() -> some View { | |
modifier(WiggleModifier()) | |
} | |
} | |
struct WiggleModifier: ViewModifier { | |
@State private var isWiggling = false |
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 Combine | |
extension Publisher { | |
var stream: AsyncThrowingStream<Output> { | |
AsyncThrowingStream(Output.self) { continuation in | |
let cancellable = sink { completion in | |
switch completion { | |
case .finished: continuation.finish() | |
case .failure(let error): continuation.finish(throwing: error) | |
} |
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
extension Publisher { | |
@discardableResult | |
func passthrough(_ closure: @escaping (Result<Output, Failure>) -> Void) -> AnyPublisher<Output, Failure> { | |
map { output in | |
closure(.success(output)) | |
return output | |
} | |
.mapError { error in | |
closure(.failure(error)) | |
return error |
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
function LandmarkRow({ landmark }) { | |
return ( | |
<HStack> | |
<Image source={landmark.image} resizable /> | |
<Text>{landmark.name}</Text> | |
<Spacer /> | |
</HStack> | |
) | |
} |
OlderNewer