cd ~/swift-projects
find . -name \*.git -exec /bin/bash -c 'cd $(dirname {}) && pwd && git fetch' \;
cd swift
./utils/update-checkout --tag swift-5.4.2-RELEASE
| T0.x1 |
Few tips from using the nix package manager on macOS.
| nm __BINARY__ | awk '{ print $3 }' | xargs xcrun swift-demangle {} \; | less |
| #!/bin/bash | |
| # This program cleans out the implcit module cache and modulemaps. | |
| # Remove modulemaps to prevent loading lingering invalid modulemaps | |
| # ( Genfiles is not cleared for each incremental build ) | |
| set -e | |
| SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| WORKSPACE_DIR="$SCRIPTPATH/../" | |
| EXEC_ROOT=$($WORKSPACE_DIR/tools/bazelwrapper info execution_root) |
| # List all of the current branches - invert * as it represents the current one | |
| # and will cause many issues | |
| for B in $(git branch --list | grep --invert '*'); do git branch -D $B; done | |
| # Additional ideas are cleaning up the remote ( i.e. ): | |
| for B in $(git branch -a --list | grep --invert '*'); do git push origin : $B; done |
| #!/bin/bash | |
| # Path to the swift compiler | |
| SWIFT=(~/myswift/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift) | |
| SWIFTC=(~/myswift/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc) | |
| IFS='' read -d '' -r SOURCE <<"EOF" | |
| struct Some { | |
| let attr = 0 | |
| } |
| func helloWorld(a: Int) { | |
| print("Hello world!", 1) | |
| } | |
| // Converting to an address: | |
| // - Erase the type to an Object so swift doesn't complain | |
| // - Bitcast | |
| var erasedFunc = helloWorld as AnyObject | |
| let address = unsafeBitCast(erasedFunc, to: Int.self) |
| " Insert content into vim buffer programmatically | |
| " Exe: | |
| :exe ":normal i" . "some" | |
| " FeedKeys: | |
| :call feedkeys("i". "some") | |
| " Basic example of using Python with vim | |
| " This is basic vim plugin boilerplate | |
| let s:save_cpo = &cpo | |
| set cpo&vim | |
| function! s:UsingPython3() | |
| if has('python3') | |
| return 1 | |
| endif |