Skip to content

Instantly share code, notes, and snippets.

View disable_ocsp.md

This is usefull when you are experiencing network issues and the apps refuse to open (icon jumping, no window shown) because macOS can't complete its oscp signature verification on binaries. Or just if you want to disable it for other reasons.

Open /etc/hosts and add:

0.0.0.0 ocsp.apple.com

Everything should open normally now.

@uraimo
uraimo / swift_compiler_generate_swift.xcodeproj.md
Created Apr 29, 2020
How to generate Swift.xcodeproj for the apple/swift compiler without building everything
View swift_compiler_generate_swift.xcodeproj.md

Clone the Swift compiler and all the related subprojects and then just create the build directories without compiling:

mkdir swiftlang
cd swiftlang
git clone https://github.com/apple/swift.git
./swift/utils/update-checkout --clone
cd swift
utils/build-script --release-debuginfo --xcode --skip-build
@uraimo
uraimo / new_homebrew_formula.md
Last active Apr 12, 2020
Create a new homebrew formula and submit it/private tap
View new_homebrew_formula.md

Creating a new Homebrew formula

Simplified procedure extracted from the contribution guidelines and the guide.

Example for a new go application, the install step and the dependencies will be different if you are building something else.

  1. Update brew:

    brew update

@uraimo
uraimo / swift_globals_checks.md
Created Jul 2, 2019
Check if a function is defined in the global namespace in Swift
View swift_globals_checks.md
guard dlsym(nil,"iDontExistOnThisPlatformSorry") != nil else {print("Doesn't exist!");exit(0)}
View compiling_swift_armv6_on_debianarmv7.md
  • Link gcc and g++ to clang and clang++ respectively if necessary

  • Move /bin/uname to /bin/uname.orig and override it with a /bin/uname script that calls /bin/uname.orig "$@" | sed 's/armv7l/armv6l/g'

  • Force armv6l for build-impl-script instead of using python's platform.machine() that calls the uname syscall (setarch cannot be used since armv6 cannot be set...):

    diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.
    py
    index 2859677fac..b7d65c4f9a 100644
    --- a/utils/swift_build_support/swift_build_support/targets.py
    
View docker_image_squash.md

How to squash an image with multiple layers in a single new one (losing history).

Enable experimental features in Docker

Using --squash requires a Docker with and API version greater than 1.13 (can be checked with docker version).

Edit /etc/docker/daemon.json adding:

  {
      "experimental": true
View linux_one_liners.md

Just some useful one liners.

  • A better way to get the ARCH for a binary:

    readelf -a -W <binary> | grep CPU
    
@uraimo
uraimo / fuse-ext2-macos.md
Created May 17, 2019
Install fuse-ext2 with minimal effort on macOS
View fuse-ext2-macos.md

Install the dependencies:

brew install m4 autoconf automake libtool e2fsprogs

Clone and build:

git clone https://github.com/alperakcan/fuse-ext2.git	
cd fuse-ext2
@uraimo
uraimo / multiple_github_accounts_guide.md
Last active Apr 12, 2020
Configuring multiple github accounts for work and private
View multiple_github_accounts_guide.md

In this short guide two sample user will be used: leisure and work.

  1. Create two ssh keys, one of each user, and register them with their github account on the site. Let's suppose you have created id_rsa_work and id_rsa_leisure.

  2. Configure ssh using two virtual hosts, one for work and one for leisure, each one linked to one of the keys:

     # Personal GitHub account
     Host leisure-github.com
       HostName github.com
    
View snmp_guide.md

To traverse the tree of public data (i.e. "public" community), starting from the "iso" root:

  snmpwalk -v 2c -Cc -c public -m ALL 10.0.0.1 iso

To print out private data ("private" community, enterprises leaf(1.3.6.1.4)):

  snmpwalk -v 2c -c private -l authPriv -u "user" -a MD5 -A "pass" -x DES -X "pass"  -m ALL 10.0.0.1  1.3.6.1.4