Skip to content

Instantly share code, notes, and snippets.

View blulion's full-sized avatar

Anish Kumar blulion

  • Bangalore, India
View GitHub Profile
@blulion
blulion / Dev Certificate
Created June 10, 2022 17:26 — forked from swapnull-in/Dev Certificate
Making a PEM File for iOS Push Notifications (From Ray Wenderlich's tutorial)
# Convert the .cer file into a .pem file:
$ openssl x509 -in aps_development.cer -inform der -out apns_cert_dev.pem
# Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -in aps_development.p12 -out apns_key_dev.pem
# Finally, combine the certificate and key into a single .pem file
$ cat apns_cert_dev.pem apns_key_dev.pem > ck_dev.pem
# At this point it’s a good idea to test whether the certificate works.

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@blulion
blulion / UIScrollView+UIPageControl.swift
Created September 9, 2021 07:24 — forked from kishikawakatsumi/UIScrollView+UIPageControl.swift
UIScrollView + UIPageControl with RxSwift
import RxSwift
import RxCocoa
fileprivate extension Reactive where Base: UIScrollView {
fileprivate var currentPage: Observable<Int> {
return didEndDecelerating.map({
let pageWidth = self.base.frame.width
let page = floor((self.base.contentOffset.x - pageWidth / 2) / pageWidth) + 1
return Int(page)
})
@blulion
blulion / LOC excluding pods
Created June 10, 2020 14:04
Swift Loc Command excluding Pods
find . -path ./Pods -prune -o -name "*.swift" -print0 ! -name "/Pods" | xargs -0 wc -l
https://gist.github.com/Tokuriku/f7d6ce5a68d2154c28b0#gistcomment-1781457