Skip to content

Instantly share code, notes, and snippets.

Avatar

Jayant Dash jayantnd

  • Comcast
  • Philadelphia
View GitHub Profile
View jenkins-git-backup.sh
#!/bin/bash
set -ex
if [ $# -ne 3 ]; then
echo usage: $0 jenkins_home git_repos_url backup_folder
exit 1
fi
# Jenkins home folder
@jayantnd
jayantnd / .env
Created February 10, 2021 03:59 — forked from joshdholtz/.env
Using Dotenv and environment variables with fastlane
View .env
STUFF = this is some stuff
@jayantnd
jayantnd / auto_git_file.md
Created February 9, 2021 18:45 — forked from darencard/auto_git_file.md
Automatic file git commit/push upon change
View auto_git_file.md
View 00-Dotfile-Dropbox-git-commit-on-save.md
View 00-Dotfile-Dropbox-git-commit-on-save.md

My bash-fu is laughable and this took me days (yes, days!) to put together, so hope it helps.

It uses fswatch which you should have installed and is supposedly cross-platform, but I've only tested it on MacOS (brew install fswatch).

Dotfile Dropbox git auto-committer

This is my use case:

  • I keep my dotfiles in multiple git repos under ~/Dropbox/dotfiles.
  • I symlink them to wherever they need to be.
@jayantnd
jayantnd / CertificatePinningURLSessionDelegate.swift
Created November 6, 2018 18:57 — forked from daniel-rueda/CertificatePinningURLSessionDelegate.swift
Certificate and Public Key Pinning for URLSession using Swift
View CertificatePinningURLSessionDelegate.swift
// Based on https://code.tutsplus.com/articles/securing-communications-on-ios--cms-28529
import Foundation
import Security
struct Certificate {
let certificate: SecCertificate
let data: Data
}
@jayantnd
jayantnd / PhonecallReceiver.java
Created October 28, 2018 20:53 — forked from ftvs/PhonecallReceiver.java
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
View PhonecallReceiver.java
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@jayantnd
jayantnd / AppStoryboard.swift
Created October 7, 2018 17:34 — forked from Gurdeep0602/AppStoryboard.swift
AppStoryboard enumeration
View AppStoryboard.swift
//
// AppStoryboards.swift
// AppStoryboards
//
// Created by Gurdeep on 15/12/16.
// Copyright © 2016 Gurdeep. All rights reserved.
//
import Foundation
import UIKit
View SynchronizedArray.swift
import Foundation
import PlaygroundSupport
/// A thread-safe array.
public class SynchronizedArray<Element> {
fileprivate let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent)
fileprivate var array = [Element]()
}
// MARK: - Properties
@jayantnd
jayantnd / channel-example.swift
Created July 27, 2017 15:19 — forked from kainosnoema/channel-example.swift
Golang-like concurrency semantics in Swift
View channel-example.swift
import Foundation
go(println("in a thread"))
// buffered channel
var c = Chan(buffer:20)
// sending routing
go {
while(true) {