Skip to content

Instantly share code, notes, and snippets.

@uraimo
uraimo / raspberrypi_wifi_headless_config.md
Last active December 2, 2021 08:14
Config/recover an headless pi wireless

To configure the wireless connection of a newly installed Pi or an old one with an obsolete wireless config, just create a file wpa_supplicant.conf file on the /boot/ fat32 partition with this content:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=GB
update_config=1

network={
 ssid="<Name of your wireless LAN>"
 psk=""
@uraimo
uraimo / disable_ocsp.md
Created November 27, 2020 09:53
Disable oscp

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 April 29, 2020 08:50
How to generate Swift.xcodeproj for the apple/swift compiler without building everything

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 September 4, 2024 03:58
Create a new homebrew formula and submit it/private tap

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 July 2, 2019 08:50
Check if a function is defined in the global namespace in Swift
guard dlsym(nil,"iDontExistOnThisPlatformSorry") != nil else {print("Doesn't exist!");exit(0)}
  • 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

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

Just some useful one liners.

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

readelf -a -W | grep CPU

@uraimo
uraimo / fuse-ext2-macos.md
Created May 17, 2019 13:35
Install fuse-ext2 with minimal effort on macOS

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 April 12, 2020 13:26
Configuring multiple github accounts for work and private

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