Skip to content

Instantly share code, notes, and snippets.

View esycat's full-sized avatar
💃

Eugene Janusov esycat

💃
View GitHub Profile
@esycat
esycat / git-find-unique-commits-nr.sh
Last active June 16, 2017 14:23
Find the number of unique commits since the given date on all remote heads
# N.B. The uniquenes is determined based on `git-patch-id` that is simply a hash of the diff
since="2016-07-01"
for c in $(git log --since="${since}" --remotes --format="%H") ; do git show $c | git patch-id ; done | sort -u | wc -l
@esycat
esycat / WEEKDAYOFMONTH.vba
Created July 14, 2019 12:41
A custom function for Excel to find Nth weekday of the month
Function WEEKDAYOFMONTH(month As Date, dow As Integer, offset As Integer)
FirstDayOfMonth = month - Day(month) + 1
LastDayOfMonth = WorksheetFunction.EoMonth(month, 0)
If offset > 0 Then
StartDate = FirstDayOfMonth + offset * 7
adjustment = weekday(FirstDayOfMonth + 7 - dow)
ElseIf offset < 0 Then
StartDate = LastDayOfMonth + (offset + 1) * 7
adjustment = weekday(LastDayOfMonth - dow)