Skip to content

Instantly share code, notes, and snippets.

View chunlea's full-sized avatar
👨‍💻
Working from home

chunli chunlea

👨‍💻
Working from home
View GitHub Profile
@ShikiSuen
ShikiSuen / IMKSuggestion.md
Last active March 24, 2024 07:29
Let's talk about what InputMethodKits needs to improve.

Related sample project: https://github.com/vChewing/vChewing-macOS/tree/3.4.9

It seems that individual bug reports doesn't work at all. Besides, the entire InputMethodKit needs a renovation.

This thread will be sent to Apple by certain special approaches after gathering enough usable information.

Let's talk about what InputMethodKits needs to improve. Here's my conclusion. If Apple think there's already an API, then it might be either mulfunctioning or not exposed to Swift.

  1. An official Swift-friendly wrapper with neither "!" nor "?" in the parameters of all provided APIs.
require 'webrick'
# How much of this is solved by frozen string literal?
Ractor.make_shareable(WEBrick::Config::HTTP)
Ractor.make_shareable(WEBrick::LF)
Ractor.make_shareable(WEBrick::CRLF)
Ractor.make_shareable(WEBrick::HTTPRequest::BODY_CONTAINABLE_METHODS)
Ractor.make_shareable(WEBrick::HTTPStatus::StatusMessage)
# To pick up changes from https://github.com/ruby/ruby/pull/4007
Object.send(:remove_const, :URI)
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@steventroughtonsmith
steventroughtonsmith / bitcode2intel
Created May 18, 2019 15:31
Converts an ARM64 iOS app with Bitcode into an X86_64 variant
#!/bin/bash
TARGET="$( cd "$(dirname "$1")" ; pwd -P )/$1"
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
TARGET_ARCH=x86_64
export IPHONEOS_DEPLOYMENT_TARGET=12.2
rm -r /tmp/bitcode2intel
mkdir -p /tmp/bitcode2intel
pushd /tmp/bitcode2intel
- aeson
- aeson-casing
- aeson-iproute
- aeson-pretty
- aeson-typescript
- amazonka
- amazonka-core
- amazonka-s3
- amazonka-sqs
- async
#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
!!! There's a better solution here now, that doesn't require swizzling:
!!! http://www.splinter.com.au/2014/09/10/afnetworking-error-bodies/
!!! But i'll leave the below swizzling solution up for old time's sake
// AFURLSessionManager+ErrorResponse.h
// This hacks AFURLSessionManager so that it returns the error response in failure callbacks, in the error's userInfo.
// Usage:
// [mySessionManager POST:@"some_api_endpoint" parameters:params success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) {
@zqqf16
zqqf16 / IPSecDemo.m
Last active May 29, 2020 08:11
Start IPSec programmatically in iOS 8
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
@anirudh-chhangani
anirudh-chhangani / gist:9989292
Last active April 1, 2018 07:49
Reformatted Tiny 2048.c
M[16],X=16,W,k;
main(){
T(system("stty cbreak"));
puts(W&1?"WIN":"LOSE");
}
K[]={2,3,1};
s(f,d,i,j,l,P){
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2