How to Delete Github Repository Quickly

I did some spring-cleaning on my Github repositories a few days ago.

I was doing it manually at first, by going through the repository settings page, clicked on the delete button in the Danger Zone section, went through several popups and finally entered the repository name to confirm the deletion. Yeah… it’s such a boring chore.

Then, I remembered that Github has a cli client that I have been using for creating repo and pull requests. Figured I might take a look again at their docs to see if there’s a command for deleting a repository or setting a repository to private, and there is one! The usage is simple too. Here’s how.

Install gh

If you don’t have it install yet, simply run the following command:

brew install gh

Once that’s done, run the following command to authenticate with Github:

gh auth login

To delete a repository

To delete a repository, run the following command

# add --yes to confirm deletion without prompting
gh repo delete $REPO --yes

To change from public to private repository

To modify repository access, run the following command:

gh repo edit $REPO --visibility=private

Replace $REPO with the repo name. You can use either the full URL or the repo name. For example.

# to delete using url
gh repo delete https://github.com/faizmokh/dummyrepo

# to modify access using repo name
gh repo edit faizmokh/dummyrepo --visibility=private

That’s all. Go through the docs, if you want to know what else you can do with gh

References:

  1. gh cli documentation

A Cheaper Way to Renew Apple Developer Account

My Apple Developer account renewal lapsed early last year because my bank flagged it as foreign transaction. They did call me to verify it but the transaction had been declined by Apple by the time my bank approved it. Long story short, I did not renew my membership.

But now I felt like renewing it again to release all my “almost finished” side projects. I headed to the Apple Developer website, but to my surprised, the price is RM399/year now. I’m pretty sure it was cheaper last year.

Pricing on the Apple Developer website

So I checked the Developer app to see if the price is different, and it is! It is still RM369/year on the app. Somewhat weird, but my guess is this has something to do with the App Store having less “dynamic” pricing as compared to the website. From what I noticed over the years, there will be a lot of news whenever they upgrade their App Store Tier pricing.

Pricing on the Developer app

So if you’re looking to subscribe or renew your Apple Developer account, maybe you can try subscribing it through the app.

How to Convert SSL Certificate From CER to DER Format

Today I learned how to convert SSL certificate that is using crt format to der format while working on updating the certificate that was pinned in our iOS app. Here’s a quick guide on the how-to.

First of all make sure you have openssl installed in your machine. Then run the following command in your terminal:

openssl x509 -in input_cert.crt -out output_cert.der -outform der

Make sure to replace input_cert.crt and output_cert.der with the actual filenames of your certificates.

That’s it. Easy right?

Additional info

  1. Make sure you pass in the -outform der flag. Otherwise openssl will default to pem format
  2. x509 subcommand stands for X.509 certificate, which is a standard format for public key certificates.

How to Install Specific Version of Brew Cask

Brew Cask is an extension of Homebrew that allows us to install GUI tools or 3rd party binaries easily just by using command line.

It is so convenient and I have been using it to install most of my app like Chrome, Android Studio or VSCode for years. One of the app I used regularly is Periphery, which is a tool for identifying unused codes in iOS projects.

Recently, I ran brew upgrade and unfortunately the update caused Periphery app to stop working. The latest version(2.15.0) requires Swift 5.7 but I’m still using Xcode 14.1. I thought I could just run brew install periphery@2.14.0 to downgrade the version but it did not work.

Did some googling but the steps aren’t straightforward so I will document it down here for my future self.


So here’s the steps:

  1. Google the casks that you want to install the specific version of here. If it’s not part of brew, search it on Github. For example here’s the page for periphery
  2. Go through the commits history. Find the version that you want and the cask file
  3. Copy the URL of the raw file
  4. Run brew install --cask [RAW_FILE_URL]. For example if I want to install periphery@2.14.0 I need to run the following command:
    brew install --cask https://raw.githubusercontent.com/peripheryapp/homebrew-periphery/6f8d7a080fc41e336ec6f1dca9039117a7886875/Casks/periphery.rb

Other Ways to Install

There’s another way to install by using brew edit.

Here’s the steps:

  1. Run brew edit [APP_NAME]. Note that running this for the first time will trigger the following warning message since you will be editing the Cask file directly

    Warning: edit is a developer command, so Homebrew's
    developer mode has been automatically turned on.
    To turn developer mode off, run:
    brew developer off
  2. Update the version and sha256 value based on the version that you want to install. You can find the info on Github. Using the same example:

     cask 'periphery' do
    -    version '2.15.0'
    -    sha256 '7f0d05c7e9d04925f8c8ed4365146c23abd3b4ac1a5865f125438ce9851f93f7'
    +    version '2.14.0'
    +    sha256 'f44af8004706416610709ed4f913cedc06e458941a6968c095c475bef54e1920'
         url "https://github.com/peripheryapp/periphery/releases/download/#{version}/periphery-#{version}.zip"
         name 'Periphery'
         homepage 'https://github.com/peripheryapp/periphery'
         binary 'periphery'
         depends_on macos: '>= :catalina'
         ```
    
         zap delete: [
         '~/Library/Caches/com.github.peripheryapp',
         '~/Library/Caches/com.peripheryapp.periphery'
         ]
     end
    
  3. Save it and simply run brew reinstall [APP_NAME].

That’s all. Hope this helps.

How to Fix Xcode 14.3 libarclite_iphonesimulator.a Error

While upgrading Carthage libraries for Xcode 14.3.1, one of the libraries that my team depends on is throwing errors. I checked the repo and found out that the library have been archived. I forked the repo and tried to run it locally.

It threw the following error when I ran it:

ld: file not found: /Applications/Xcode-14.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Apparently, this is because with Xcode 14.3.1 the minimum deployment target have been set to iOS 11. DZNEmptyDataSet is still using iOS 8 as its minimum deployment target. Upgrading it to iOS 11 fixed the error.

p/s: Yeah I know the usage of this library is somewhat unecessary but it’s already being used everywhere and replacing it with our implementation will require huge effort. Maybe some day. Not today.