Skip to content

Instantly share code, notes, and snippets.

@antongaenko
antongaenko / .bash_profile
Created June 30, 2022 10:26
My bash and git aliases
# git
alias gs='clear | git status -u'
alias gl="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias glon="git log --pretty=oneline"
alias gph='git push'
alias gpo='git push --set-upstream origin'
alias gpt='git format-patch'
#git format-patch cc1dde0dd^..6de6d4b06 --stdout > foo.patch
@antongaenko
antongaenko / Storing-Images-On-Github.md
Created January 22, 2021 17:28 — forked from joncardasis/Storing-Images-On-Github.md
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

@antongaenko
antongaenko / how_to_connect.md
Created February 16, 2020 17:01 — forked from super-dog-human/how_to_connect.md
How to connect Oculus Go controller(OMVR-V190) to macOS 10.12
  1. Prepare a Mac supports BLE
  2. Download the Additional Tools for Xcode from Apple Developer
  3. Open the Bluetooth Explorer
  4. Press and hold the Oculus button and back button of controller until the controller LED blinks
  5. Select menu [Devices] -> [Low Energy Devices]
  6. Click [Start Scanning] button.
  7. Chose OMVR-V190 in Device and click [Connect] button.
@antongaenko
antongaenko / gist:ead3d615160df43b108bf62ac2467245
Created November 22, 2019 18:23 — forked from steipete/ios-xcode-device-support.sh
Using iOS 13.2 devices with Xcode 11.1 (instead of Xcode 11.2) (also, Xcode 10.3)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Support iOS 13.2 devices (Xcode 11.2) with Xcode 11.1:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.2 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Xcode 10.3 to Xcode 11
sudo ln -s /Applications/Xcode-11.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode-10.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
@antongaenko
antongaenko / convert_imports.rb
Created June 26, 2017 11:06 — forked from smileyborg/convert_imports.rb
A script to convert textual imports to framework imports. Useful when converting static libraries to dynamic frameworks.
#!/usr/bin/env ruby
require 'set'
UMBRELLA_HEADER_PATH = ARGV[0] # The path to the umbrella header containing all the headers
SOURCE_ROOT_PATH = ARGV[1] # The path containing the source files to convert (will be recursively searched)
FRAMEWORK_NAME = File.basename(UMBRELLA_HEADER_PATH, ".*") # Assumes that the framework name is the same as the umbrella header filename (e.g. "MyFramework" for "MyFramework.h")
UMBRELLA_IMPORT_REGEX = /#import\s+<#{FRAMEWORK_NAME}\/.+\.h>/ # Matches "#import <FrameworkName/Header.h>"
FRAMEWORK_HEADER_REGEX = /(?<=<#{FRAMEWORK_NAME}\/).+\.h(?=>)/ # Matches "Header.h" in "<FrameworkName/Header.h>"
@antongaenko
antongaenko / generate_umbrella.rb
Created June 21, 2017 15:53 — forked from tyronet-sportsbet/generate_umbrella.rb
Generates a naïve umbrella header by assuming every header in the working folder or any of its subfolders is public and should be included
#!/usr/bin/env ruby
# Your umbrella header needs a comment in it like the below so this script
# knows which parts to replace
#
# /* IMPORTS BEGIN */
#
# /* IMPORTS END */
MODULE = ARGV[0] || File.basename(Dir.getwd)
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
# Step 2. Copy the framework structure to the universal folder
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
// make .strings from all NSLocalizedString occuerences
find ./ -name "*.m" -print0 | xargs -0 genstrings
// Count words in a file for localization cost estimate
cat Localizable.strings | grep ';$' | awk -F= '{ print $2 }' | wc -w