Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Looking for Opportunity

Sangram sangram-chavan

💭
Looking for Opportunity
View GitHub Profile
@sangram-chavan
sangram-chavan / README.md
Created Mar 18, 2020 — forked from jamesramsay/README.md
Gmail: delete old emails automatically
View README.md

Gmail: delete old emails automatically

Automatically deletes old emails that match the specified label.

Get started

  • Create a new Google Apps Script at https://script.google.com
  • Overwrite the placeholder with the javascript below
  • Update the following constants:
    • LABEL_TO_DELETE: the label that should be have old messages deleted
@sangram-chavan
sangram-chavan / DateTime Precision
Created May 5, 2015
Calculate DateTime, Environment.Ticks and Stopwatch Precision
View DateTime Precision
int xcnt = 0;
long xdelta, xstart;
xstart = DateTime.UtcNow.Ticks;
do
{
xdelta = DateTime.UtcNow.Ticks - xstart;
xcnt++;
} while (xdelta == 0);
Console.WriteLine("DateTime:\t{0} ms, in {1} cycles", xdelta / (10000.0), xcnt);
View Clear EventViewer Log.bat
@echo off
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
echo.
echo goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View CustomTimeSpanFormatter
/* Custom TimeSpan formar
@"%s",
@"%s\.f",
@"%s\.f",
@"%s\.ff",
@"%s\.fff",
@"%m\:%s",
@"%m\:%s\.f",
@"%m\:%s\.ff",
@sangram-chavan
sangram-chavan / Create-Bootable-ISO-Image-From-OS-X-For-VirtualBox
Last active Apr 14, 2020
Create-Bootable-ISO-Image-From-OS-X-For-VirtualBox
View Create-Bootable-ISO-Image-From-OS-X-For-VirtualBox
Create-Bootable-ISO-Image-From-OS-X-Yosemite-For-Intel-Based-Machines
# Mount the installer image
hdiutil attach Install\ OS\ X\ Yosemite.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite
# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g /tmp/Yosemite.sparseimage