Skip to content

Instantly share code, notes, and snippets.

View Scvairy's full-sized avatar

Timur Sharifyanov Scvairy

View GitHub Profile
@unixzii
unixzii / ForceEnablingXcodeLLM.md
Last active July 4, 2024 09:03
A guide to force enabling Xcode LLM feature on China-SKU Macs.

Introduction

Apple restricted the access to Xcode LLM (Predictive code completion) feature on China models of Mac. This guide provides a way to bypass that restriction. It's verified on macOS 15.0 Beta (24A5264n), but there is no guarentee that it will always work on later macOS versions.

Prerequisites

  • Xcode is installed and run at least once.
  • SIP debugging restrictions are disabled (via csrutil enable --without debug command in recovery mode).

Disclaimer

@santaklouse
santaklouse / CrossOver.sh
Last active July 6, 2024 15:14
unlimited CrossOver trial (MacOS)
#!/usr/bin/env bash
# checck if pidof exists
PIDOF="$(which pidof)"
# and if not - install it
(test "${PIDOF}" && test -f "${PIDOF}") || brew install pidof
# find app in default paths
CO_PWD=~/Applications/CrossOver.app/Contents/MacOS
test -d "${CO_PWD}" || CO_PWD=/Applications/CrossOver.app/Contents/MacOS
@zats
zats / REMAP_M1_KEYS.MD
Last active December 23, 2023 20:32
Apple M1 MacBook Do Not Disturb Key remapping

Following is a sample of LaungAgent that remaps do not disturb key to Siri (I am using Type to Siri)

This is a lightweight solution not relying on external apps.

Setting up

  1. Create ~/Library/LaunchAgents/com.local.KeyRemapping.plist
  2. Edit it to have following content
@subhojit777
subhojit777 / prepare-commit-msg.sh
Last active October 14, 2020 12:57 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# JIRA branch name - JIRAPRJ-777-short-desc
# Prepended commit message - JIRAPRJ-777:<space>
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
#!/bin/sh
grep pam_tid /etc/pam.d/sudo >/dev/null || echo auth sufficient pam_tid.so | cat - /etc/pam.d/sudo | sudo tee /etc/pam.d/sudo > /dev/null
@foxicode
foxicode / String+subscript.swift
Created February 22, 2020 10:29
Swift String subscript extension
import Foundation
extension String {
subscript (i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
subscript (bounds: CountableRange<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
var obj = JSON.parse($response.body);
obj= {
"purchases": [
{
"topUpId": "iapPremiumYearly70FreeTrial",
"provider": "apple",
"receipt": "MIIULAYJKoZIhvcNAQcCoIIUHTCCFBkCAQExCzAJBgUrDgMCGgUAMIIDzQYJKoZIhvcNAQcBoIIDvgSCA7oxggO2MAoCARQCAQEEAgwAMAsCARkCAQEEAwIBAzAMAgEKAgEBBAQWAjQrMAwCAQ4CAQEEBAICAIkwDQIBCwIBAQQFAgMTIfwwDQIBDQIBAQQFAgMB1YgwDgIBAQIBAQQGAgQ4AD+TMA4CAQkCAQEEBgIEUDI1MjAOAgEQAgEBBAYCBDGIVhowEAIBDwIBAQQIAgZVhlh8FGUwEQIBAwIBAQQJDAczMS4xMi4wMBECARMCAQEECQwHMzEuMTIuMDAUAgEAAgEBBAwMClByb2R1Y3Rpb24wGAIBBAIBAgQQthX8KtETb7VYNLeOXqvzgDAcAgEFAgEBBBQF7usNDLV6JkGwLKjs5MYNIo3bTjAeAgEIAgEBBBYWFDIwMTktMDQtMjFUMTg6Mjg6NTlaMB4CAQwCAQEEFhYUMjAxOS0wNC0yMVQxODoyODo1OVowHgIBEgIBAQQWFhQyMDE5LTA0LTIxVDE3OjU5OjM3WjAlAgECAgEBBB0MG2NvbS5wbGFuYmxhYnMuZHJvcHMuaXRhbGlhbjBGAgEHAgEBBD5KvFdEpBoIn92kAmekzisa7LgVEfTLEFvYGOpK5aRsW4i70RzYl9vlpDFd1iF7Gft3wEjeSBnjBaDfyRpHajBIAgEGAgEBBEBaSa7eVaPTsa1hSAKuIqu8z5KlH/VpRatbPKSkorwXo8ewSCIBlBQFVgcoVfPpeWJdpNEnbQg8Rba1Jj+SMywgMIIBkAIBEQIBAQSCAYYxggGCMAsCAgatAgEBBAIMADALAg
@davletyarov
davletyarov / result_modifier.php
Last active June 28, 2019 10:02
Косвенный result_modifier.php
<?php
defined('B_PROLOG_INCLUDED') || die();
/**
* @global CMain $APPLICATION
* @var array $arParams
* @var array $arResult
*/
// зеркально указываем оригинальное место нахождение директори шаблона, которую мы хотим расширить косвенно
$this->__folder = '/bitrix/components/bitrix/crm.interface.filter/templates/flat';
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active July 2, 2024 13:31
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@emotality
emotality / duplicate_line_xcode.md
Last active April 6, 2024 04:23
Xcode - Duplicate Line key binding

NOTE (2022-07-09): Xcode finally added this functionality in Xcode 14, please see release notes here:

New Features in Xcode 14 Beta 3
When editing code, the Edit > Duplicate menu item and its corresponding keyboard shortcut now duplicate the selected text — or the line that currently contains the insertion point, if no text is selected. (8614499) (FB5618491)


Xcode line duplicate

Bind keys to duplicate lines in Xcode