Skip to content

Instantly share code, notes, and snippets.

View budioktaviyan's full-sized avatar
🇸🇬

Budi Oktaviyan budioktaviyan

🇸🇬
View GitHub Profile
@memoryleak
memoryleak / create-monterey-iso.sh
Last active May 1, 2024 12:38
Create a Mac OS Monterey ISO file from the official installation DMG file
#!/usr/bin/env bash
sudo hdiutil create -o /tmp/Monterey -size 16g -volname Monterey -layout SPUD -fs HFS+J
sudo hdiutil attach /tmp/Monterey.dmg -noverify -mountpoint /Volumes/Monterey
sudo /Applications/Install\ macOS\ Monterey.app/Contents/Resources/createinstallmedia --volume /Volumes/Monterey --nointeraction
hdiutil eject -force /Volumes/Install\ macOS\ Monterey
hdiutil convert /tmp/Monterey.dmg -format UDTO -o ~/Downloads/Monterey
mv -v ~/Downloads/Monterey.cdr ~/Downloads/Monterey.iso
sudo rm -fv /tmp/Monterey.dmg
@radityagumay
radityagumay / NetworkBuilder.swift
Created September 10, 2020 15:57
Network Builder in Swift based on Android Retrofit Builder Pattern
protocol Dao {
func insert(key: String, value: Any) -> Bool
func find(key: String) -> Any?
}
protocol StoreAdapterFactory {
func create() -> Dao
}
class StoreMemoryAdapter : Dao {
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active May 6, 2024 23:53
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@trenthudy
trenthudy / KotlinEnumClassGsonDeserializationTest.kt
Last active November 17, 2023 20:43
Deserializing Kotlin enum classes with Gson
package io.hudepohl
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import org.junit.Assert.assertTrue
import org.junit.Test
private const val testJson =
"""
@micer
micer / RealPathUtil.kt
Last active April 18, 2021 01:21
Utility class to get real path from URI object - all API versions
import android.content.ContentUris
import android.content.Context
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.DocumentsContract
import android.provider.MediaStore
import android.support.v4.content.CursorLoader
import android.text.TextUtils
@alejandro-martin
alejandro-martin / multiple-ssh-keys-git.adoc
Last active May 2, 2024 22:56
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@lexrus
lexrus / RxTextFieldDelegateProxy.swift
Created February 14, 2018 03:33
RxSwift extension for textFieldShouldReturn of UITextFieldDelegate
//
// RxTextFieldDelegateProxy.swift
//
// Created by Lex Tang on 2/14/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import RxSwift
import RxCocoa
@jonasz-baron
jonasz-baron / RxAlamofire+Codable.swift
Created October 11, 2017 14:09
RxAlamofire usage with Codable protocol for object mapping. Inspired by: https://gist.github.com/kciter/e6f13119cbf8ad0963a68a5ebc421069
// Model
import Foundation
class Post: Codable {
var id = 0
var userId = 0
var title = ""
var body = ""
}
@vzsg
vzsg / RxAlamofire+Multipart.swift
Created July 26, 2017 09:28
Alamofire+RX multipart encoding
import Foundation
import Alamofire
import RxSwift
extension Reactive where Base: SessionManager {
func encodeMultipartUpload(to url: URLConvertible, method: HTTPMethod = .post, headers: HTTPHeaders = [:], data: @escaping (MultipartFormData) -> Void) -> Observable<UploadRequest> {
return Observable.create { observer in
self.base.upload(multipartFormData: data,
to: url,
method: method,
//
// MazeViewController.swift
//
import UIKit
import Foundation
import RxSwift
class MazeViewController: UIViewController {
var currentDisposable: Disposable? = nil