Skip to content

Instantly share code, notes, and snippets.

@Shrulik
Shrulik / gist:6a9e2848c554688c340b7d0438585009
Created October 16, 2017 11:41
Azure Function Timer Trigger Schedule/ Cron Expression - Occur never - practically speaking
After playing around a bit, I settled on :
0 0 5 29 2 Mon
Doing something like 30 of Feburary threw an error.
The next three occurrences of the above are :
29/02/2044 05:00:00
29/02/2072 05:00:00
29/02/2112 05:00:00
@Shrulik
Shrulik / git-contention
Created December 6, 2016 08:34
Git File Contention - Simple bash script to list the $n files with the most commits in a git repo
#!/bin/bash
# Source of most of this code : http://stackoverflow.com/questions/5669621/git-find-out-which-files-have-had-the-most-commits
if [[ $# -ne 1 ]]; then
echo "
Usage : Please enter a single number argument to see this number of the highest contention ( most commited )
files in the current git repository.
"
exit 4
@Shrulik
Shrulik / pre-commit.sh
Last active November 29, 2016 14:13 — forked from intjonathan/pre-commit.sh
pre-commit hook (add to .git/hooks/pre-commit) to refuse to commit debugger strings. Note list of file extensions to see which files are conisdered.
#!/bin/sh
# Refuse to commit files with the string NOCOMMIT, debugger, or merge markers present.
#
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-)
if [ "$files" != "" ]
then
for f in $files
do
@Shrulik
Shrulik / STS_FederationToken_nodejs
Created March 18, 2014 16:43
This is a simple example of how to use STS.getFederationToken and its result to perform actions with the new credentials, in this case S3.putObject
var aws = require('aws-sdk')
aws.config.update({accessKeyId: nconf.get('AWS_KEY'),
secretAccessKey: nconf.get('AWS_SECRET')});
var STS = new aws.STS({apiVersion: '2011-06-15'});
var tempCred = STS.getFederationToken(
{'Name': token, 'Policy': JSON.stringify(policy), 'DurationSeconds': 90000},
function (err, data) {