Skip to content

Instantly share code, notes, and snippets.

@lukluca
lukluca / gist:b67c1f05c2ea0cbec77113102e5d0b1c
Created November 12, 2019 11:10
Fix AppleThunderbolt driver issue
1) reboot with CMD+R pressed.
2) open Terminal
3) csrutil disable
4) reboot in normal mode
5) sudo mv /System/Library/Extensions/AppleThunderboltNHI.kext /System/Library/Extensions/AppleThunderboltNHI.kext.BAK
6) reboot with CMD+R pressed
7) csrutil enable
8) reboot and forget about problem
@lukluca
lukluca / gist:cccfec9840c2d750bc7371afd9293b64
Created June 25, 2020 12:08
FIX AppleThunderboltNHI Catalina reboot
1) Reboot with CMD+R pressed to boot into macOS Recovery
2) Open Terminal from Utilities menu
3) Type: mv /Volumes/Macintosh\ HD/System/Library/Extensions/AppleThunderboltNHI.kext /Volumes/Macintosh\ HD/System/Library/Extensions/AppleThunderboltNHI.kext.BAK
4) Reboot and fuhgedaboudit
@lukluca
lukluca / SaveAsSeparatePDFs.vb
Last active November 25, 2022 21:36
Visual Basic function to save data as separated pdfs in multiple pages
Sub SaveAsSeparatePDFs()
'Updated by LukLuca 9-11-2020
Dim xPathStr As Variant
Dim xDictoryStr As String
Dim xFileDlg As FileDialog
Dim xStartPage, xEndPage, xPages As Long
Dim xStartPageStr, xEndPageStr, xPagesStr As String
Dim xScaledEndPage As Long
Set xFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
@lukluca
lukluca / DecodableConfiguration.swift
Created March 23, 2024 17:35
Swift DecodableConfiguration
@propertyWrapper struct DecodableConfiguration<T, ConfigurationProvider> : Decodable where T : DecodableWithConfiguration, ConfigurationProvider : DecodingConfigurationProviding, T.DecodingConfiguration == ConfigurationProvider.DecodingConfiguration {
var wrappedValue: T
init(wrappedValue: T) {
self.wrappedValue = wrappedValue
}
init(wrappedValue: T, from configurationProvider: ConfigurationProvider.Type) {
self.wrappedValue = wrappedValue