Skip to content

Instantly share code, notes, and snippets.

View kewlbear's full-sized avatar

Changbeom Ahn kewlbear

View GitHub Profile
@simonbs
simonbs / childForStatusBarStyle.swift
Last active September 25, 2023 14:49
It seems that -childForStatusBarStyle: isn’t called on a UIViewController that is presented from a SwiftUI view using UIViewControllerRepresentable. Or am I doing something wrong? I came up with this *ugly* workaround that swizzles -childForStatusBarStyle: to return an associated object when present and uses the default implementation as fallback.
// We'll store a UIViewController as an associated object and don't want to store a strong reference to it.
private final class WeakBoxedValue<T: AnyObject>: NSObject {
private(set) weak var value: T?
init(_ value: T?) {
self.value = value
}
}
// Use associated objects to a UIViewController that should determine the status bar appearance.
@niw
niw / README.en.md
Last active February 13, 2024 04:24
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac
@johngray1965
johngray1965 / build_pdfium.sh
Last active June 8, 2023 11:41
Script for build pdfium for Android
#! /bin/bash
# current the latest stable android branch (from Jan 2020)
githash=daabea6ba6c09f72e956e826b132f1d1b77acb9b
# if want to run this from somewhere other then /data adjust below
basedir=/data
# exit when any command fails
set -e
@ccwasden
ccwasden / WithPopover.swift
Created February 5, 2020 13:39
Custom size popover in iOS SwiftUI
// -- Usage
struct Content: View {
@State var open = false
@State var popoverSize = CGSize(width: 300, height: 300)
var body: some View {
WithPopover(
showPopover: $open,
popoverSize: popoverSize,
pragma solidity ^0.4.23;
/// @title The Panmunjom Declaration for Peace, Prosperity and Unification of the Korean Peninsula
/// @author atomrigs
contract PanmunjomDeclaration {
string constant public content = "\xED\x95\x9C\xEB\xB0\x98\xEB\x8F\x84\xEC\x9D\x98\x20\xED\x8F\x89\xED\x99\x94\xEC\x99\x80\x20\xEB\xB2\x88\xEC\x98\x81\x2C\x20\xED\x86\xB5\xEC\x9D\xBC\xEC\x9D\x84\x20\xEC\x9C\x84\xED\x95\x9C\x20\xED\x8C\x90\xEB\xAC\xB8\xEC\xA0\x90\x20\xEC\x84\xA0\xEC\x96\xB8\x0A\x0A\xEB\x8C\x80\xED\x95\x9C\xEB\xAF\xBC\xEA\xB5\xAD\x20\xEB\xAC\xB8\xEC\x9E\xAC\xEC\x9D\xB8\x20\xEB\x8C\x80\xED\x86\xB5\xEB\xA0\xB9\xEA\xB3\xBC\x20\xEC\xA1\xB0\xEC\x84\xA0\xEB\xAF\xBC\xEC\xA3\xBC\xEC\xA3\xBC\xEC\x9D\x98\xEC\x9D\xB8\xEB\xAF\xBC\xEA\xB3\xB5\xED\x99\x94\xEA\xB5\xAD\x20\xEA\xB9\x80\xEC\xA0\x95\xEC\x9D\x80\x20\xEA\xB5\xAD\xEB\xAC\xB4\xEC\x9C\x84\xEC\x9B\x90\xEC\x9E\xA5\xEC\x9D\x80\x20\xED\x8F\x89\xED\x99\x94\xEC\x99\x80\x20\xEB\xB2\x88\xEC\x98\x81\x2C\x20\xED\x86\xB5\xEC\x9D\xBC\xEC\x9D\x84\x20\xEC\x97\xBC\xEC\x9B\x90\xED\x95\x98\x
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active April 16, 2024 01:02
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@TimOliver
TimOliver / libdsm-build-macos.sh
Last active March 28, 2019 04:00
A modified version of the libdsm build script for macOS
#!/bin/bash
# Global build settings
export SDKPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
export MIN_MACOS_VERSION=10.10
export HOST=x86_64-apple-darwin
export LDFLAGS_NATIVE="-isysroot $SDKPATH"
export TASN1_CFLAGS="-Ilibtasn1/include"
export TASN1_LIBS="-Llibtasn1 -ltasn1"
export ARCH="x86_64"
@NSURLSession0
NSURLSession0 / cloudkit-server.php
Created February 7, 2016 21:36
CloudKit server-to-server in PHP
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';
@joshenders
joshenders / mitmproxy.md
Last active July 23, 2023 14:49
mitmproxy configuration for iPad

Successful mitmproxy-3.7 setup tested on OS X 10.13.6 and iPhone X running 12.1.4

Enable IP forwarding and disable ICMP redirects to keep the iPad sending traffic to the proxy

sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet.ip.redirect=0

net.inet.ip.forwarding
Enable IP forwarding between interfaces

cmake_minimum_required(VERSION 2.8.4)
project(so29595222)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS( -std=c++11 )
set(SOURCE_FILES python_threading_example_so29595222.cpp)