Skip to content

Instantly share code, notes, and snippets.

@r-plus
r-plus / rootless-filesystem-notes.md
Last active April 4, 2023 15:48
file tree list in /var/jb (palera1n b5 rootless and install PreferenceLoader)

mobile user directory

i7:~ mobile% pwd
/var/jb/var/mobile

mobile user home directory is empty

i7:~ mobile% ls -la ~
@r-plus
r-plus / github-ios-ss.js
Created August 5, 2022 12:38
BetterTouchTool javascript transform for github iOS Simulator screenshot width 300
async (str) => {
const re = /https?:\/\/[-_.!~*\'a-zA-Z0-9;\/?:\@&=+\$,%#]+/g;
const m = str.match(re);
return `<img src=${m[0]} width=300>`;
}
@r-plus
r-plus / add_tag.mjs
Created September 22, 2021 09:15
add tag name to all lambda functions
#!/usr/bin/env zx
const aws = require('aws-sdk');
const lambda = new aws.Lambda({ region: 'ap-northeast-1' });
const functions = await lambda.listFunctions().promise();
for (const f of functions.Functions) {
const str = await $`aws lambda list-tags --resource ${f.FunctionArn}`
const json = JSON.parse(str);
@r-plus
r-plus / config.yml
Created April 14, 2021 08:58
Install yonaskolb/mint from GitHub (confirmed on CircleCI)
- run:
name: Install mint
command: |
version=$(curl -s "https://github.com/yonaskolb/Mint/releases/latest" | sed 's/^.*tag\/\([^"]*\).*$/\1/')
echo Installing mint ${version}
curl -Ls -o mint.zip https://github.com/yonaskolb/Mint/releases/download/${version}/mint.zip
unzip mint.zip
rm mint.zip
mv mint /usr/local/bin/
@r-plus
r-plus / issue.md
Last active September 6, 2020 11:40
PreferenceLoader compatibility issue on Odyssey
@r-plus
r-plus / webkit_version_in_ios.md
Last active October 7, 2023 09:39
WebKit version in iOS

確認方法

@r-plus
r-plus / DLog.h
Created May 13, 2020 14:47
DLog.h
#ifdef DEBUG
#ifdef __cplusplus
extern "C" void MyDebugLog(NSString *formatString, ...);
#else
extern void MyDebugLog(NSString *formatString, ...);
#endif
#define DLog(...) MyDebugLog(__VA_ARGS__)
#else
#define DLog(...)
extension Observable {
/// maxAttemptまでdelay間隔をあけてリトライする
///
/// - Parameters:
/// - maxAttempt: 最大リトライ回数
/// - delay: 間隔
/// - Returns: リトライしたObservable
func retry(_ maxAttempt: Int, delay: RxTimeInterval) -> Observable<Element> {
return retryWhen { (err: Observable<Error>) -> Observable<Int> in
@r-plus
r-plus / decode_into_sample.swift
Last active September 14, 2019 11:07
method for don't throw Swift.Error and keep default value if key is not present in json.
extension KeyedDecodingContainerProtocol {
func decode<T: Decodable>(into: inout T, forKey key: Self.Key) {
guard let tmp = try? self.decode(T.self, forKey: key) else { return }
into = tmp
}
}
class A: Decodable {
var hoge = "1"
enum CodingKeys: CodingKey {
@r-plus
r-plus / segv.swift
Last active January 15, 2019 14:12
Swift compiler SEGV in Xcode10.
// ===========================
// Pattern1: SEGV in Xcode10(Swift4.2 or Swift4) ~ Xcode10.1(Swift 4.2.1)
// This code compilable in Xcode 9.4.1(Swift 4.1)
// ===========================
class A {}
protocol BProtocol {
associatedtype Info: A
var info: Info? { get set }
}