Skip to content

Instantly share code, notes, and snippets.

View mobdim's full-sized avatar
💻
Working hard

Zadorozhnyj Dmitrij mobdim

💻
Working hard
View GitHub Profile
#!/bin/bash
set -e
QT_VERSION=6.9.0
QT_ARCHIVE=qt-everywhere-src-${QT_VERSION}.tar.xz
QT_DIR=qt-everywhere-src-${QT_VERSION}
NUM_CORES=$(sysctl -n hw.ncpu)
# Пути установки
import Combine
import UIKit
public protocol CombineCompatible {}
// MARK: - UIControl
public extension UIControl {
final class Subscription<SubscriberType: Subscriber, Control: UIControl>: Combine.Subscription where SubscriberType.Input == Control {
private var subscriber: SubscriberType?
private let input: Control
@mobdim
mobdim / obj2usdz.mm
Created January 24, 2023 18:06 — forked from elaughli/obj2usdz.mm
function to convert a saved obj file to USDZ in objective-c
// path to documents directory to save our usdc file
NSString* usdcPath = [documentsDirectory stringByAppendingPathComponent:@"usdcExample.usdc"];
NSURL *usdcUrl = [NSURL fileURLWithPath: usdcPath];
// path to documents directory to save our final usdz file
NSString* usdzPath = [documentsDirectory stringByAppendingPathComponent:@"usdzExample.usdz"];
NSURL *usdzUrl = [NSURL fileURLWithPath:usdzPath];
// load the .obj file at filePath as an MDLAsset
NSURL *url = [NSURL fileURLWithPath:filePath];
@mobdim
mobdim / self-signed-ssl-certificate.md
Created November 11, 2022 19:29 — forked from clemlatz/self-signed-ssl-certificate.md
Setup a self-signed SSL certificate with Nginx (server and browser)

1. Configure server: Nginx

Create the certificate:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Create a strong Diffie-Hellman group:

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
@mobdim
mobdim / pug.md
Created May 26, 2022 20:49 — forked from neretin-trike/pug.md
Туториал по HTML препроцессору Pug (Jade)
@mobdim
mobdim / topics-search.txt
Created November 5, 2021 18:57 — forked from usametov/topics-search.txt
how to search github.com for multiple topics
Github.com ui .currently does not natively supoport search for multiple topic tags as of now. However their api allows you to query multiple tags. Below is a simple example to query github.com with ecs and go topic tags.
curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:ecs+topic:go
Response from the github can be rather verbose so lets filter only relavant info such repo url and description.
curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories\?q\=topic:ecs+topic:go | jq '.items[] | {url:.url, description:.description}'
@mobdim
mobdim / carthage-xc12.sh
Created September 18, 2020 13:42 — forked from skymobilebuilds/carthage-xc12.sh
Xcode 12 Carthage Build Workaround
#!/bin/sh -e
echo "Carthage wrapper"
echo "Applying Xcode 12 workaround..."
xcconfig="/tmp/xc12-carthage.xcconfig"
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A7209 = arm64 arm64e armv7 armv7s armv6 armv8' > $xcconfig
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
echo 'ONLY_ACTIVE_ARCH=NO' >> $xcconfig
echo 'VALID_ARCHS = $(inherited) x86_64' >> $xcconfig
export XCODE_XCCONFIG_FILE="$xcconfig"
import CoreGraphics
import Accelerate
import CoreImage
import UIKit
extension CGImage {
public enum Error: Swift.Error {
case imageResizingFailed
case cgContextCreationFailed
iOS Create a Carthage Supported Framework
#iOSBySheldon
A little bit Background of Carthage:
- Carthage works like Cocoapods, but a little bit simpler.
* When creating a Cocoapods supported framework need a .podspec file to do some config, which is not required by Carthage.
* When using a Cocoapods supported framework, a workspace file will be automatically created, the umbrella header will be setup in a pod project inside workspace. It feels simple, but the whole process creates a lot files including a "giant" workspace.
* When using a Carthage supported framework, it will just download the framework, and its dependencies if any, to a folder. All we need to do is to drag and drop it to the binary linking section in the project build setting tab, for the first time. It sounds complicated but it makes the project clean.
- Carthage is written in Swift.
- Carthage internally uses `-xcodebuild` to build dependency.
xcrun simctl list devices or xcrun simctl list --json to list all simulators
xcrun simctl delete <device udid> to delete specific device
xcrun simctl delete unavailable to remove old devices for runtimes that are no longer supported
`xcrun simctl boot <device udid>` to launch (multiple) simulators
`xcrun simctl io booted recordVideo — type=mp4 ./test.mp4` to record simulator video
`xcrun simctl io booted screenshot ./screen.png` to make screenshot of simulator
`xcrun simctl openurl booted https://google.com` to open URL in simulator
`xcrun simctl addmedia booted ./test.mp4` to upload photo or video file (for photos app)
`xcrun simctl get_app_container booted <your apps bundle identifier>` to find the app container (where identifier is like *com.bundle.identifier*)