Skip to content

Instantly share code, notes, and snippets.

View jayantnd's full-sized avatar

Jayant Dash jayantnd

  • Comcast
  • Philadelphia
View GitHub Profile
#!/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
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

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
git config credential.helper store

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
// 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
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
//
// AppStoryboards.swift
// AppStoryboards
//
// Created by Gurdeep on 15/12/16.
// Copyright © 2016 Gurdeep. All rights reserved.
//
import Foundation
import UIKit
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
import Foundation
go(println("in a thread"))
// buffered channel
var c = Chan(buffer:20)
// sending routing
go {
while(true) {