Skip to content

Instantly share code, notes, and snippets.

View abesmon's full-sized avatar
🎱
SHIT ==> GOLD

Alexey Lysenko abesmon

🎱
SHIT ==> GOLD
View GitHub Profile

How to install game-porting-toolkit (aka proton for macOS)

You also might wanna just use Whisky which does this automatically

This guide works on macOS 13.4+ using Command Line Tools for XCode 15 Beta!

What is this?

In the recent WWDC, Apple announced and released the "game porting toolkit", which upon further inspection this is just a modified version of CrossOver's fork of wine which is a "compatibility layer" that allows you to run Windows applications on macOS and Linux.

@mrdekk
mrdekk / AsyncOperation.swift
Last active November 21, 2023 13:47
Simple Swift AsyncOperation
class AsyncOperation : Operation {
private var _isExecuting = false
private var _isFinished = false
override func start() {
guard !isCancelled else {
finish()
return
}
@abhi21git
abhi21git / ExtensionURLRequest.swift
Last active February 19, 2024 12:23
Swift cURL Printer
//
// ExtensionURLRequest.swift
//
// Created by Abhishek Maurya on 16/07/20.
// Copyright © 2020. All rights reserved.
//
import Foundation
extension URLRequest {
@abesmon
abesmon / some.md
Created November 25, 2019 14:07
about objc blocks

Also, there is some info on: http://fuckingblocksyntax.com

/// returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};

void (^printXAndY)(int) = ^(int y) {
    printf("%d %d\n", x, y);
};

printXAndY(4);
@yusuke024
yusuke024 / ViewController.swift
Created November 16, 2018 03:15
Recording video with AVAssetWriter
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .notDetermined:
@cprovatas
cprovatas / Data+PrettyPrint.swift
Created May 23, 2018 15:52
Pretty print JSON string from Data in Swift 4.1 (especially useful printing to Xcode console)
import Foundation
extension Data {
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
}
@fousa
fousa / FairPlayer.swift
Last active June 1, 2023 12:28
Integrate HLS with FairPlay.
class FairPlayer: AVPlayer {
private let queue = DispatchQueue(label: "com.icapps.fairplay.queue")
func play(asset: AVURLAsset) {
// Set the resource loader delegate to this class. The `resourceLoader`'s delegate will be
// triggered when FairPlay handling is required.
asset.resourceLoader.setDelegate(self, queue: queue)
// Load the asset in the player.
@cyan198
cyan198 / Readme.MD
Last active November 3, 2022 12:14
Setup WiFi with snap on Ubuntu Core

Connect to WiFi on Ubuntu Core using Snap

It was done on the following environment:

  • Raspberry Pi 3 Model B
  • OS: Ubuntu Core
  • Pi is connected to internet via Ethernet

Here are the overview of the steps:

@rnapier
rnapier / json.swift
Last active January 31, 2024 12:49
Generic JSON Decodable
import Foundation
@dynamicMemberLookup
enum JSON: Codable, CustomStringConvertible {
var description: String {
switch self {
case .string(let string): return "\"\(string)\""
case .number(let double):
if let int = Int(exactly: double) {
return "\(int)"
@jonblatho
jonblatho / ModelName.swift
Last active April 18, 2024 23:11
An easy way to get a pretty name for an iOS device model.
import UIKit
extension UIDevice {
/// A "pretty" device name for the machine identifier.
///
/// Current for devices supporting iOS 9 and later and tvOS 9 and later, as of WWDC 2019.
var modelName: String {
var machineString = String()
var systemInfo = utsname()