Skip to content

Instantly share code, notes, and snippets.

@rajata07
rajata07 / azure_poll_status.py
Created August 10, 2020 15:57
Azure Function Poll status for data factory
# returning 202 status from Azure function will result in data factory to poll the status every "Retry-After" seconds
# This is now possible also with durable functions
def main(req: func.HttpRequest) -> func.HttpResponse:
try:
status = get_status()
status_query_url = os.getenv("status_query_app_url") % (os.getenv('env'))
if not status:
return func.HttpResponse(status_code=202, headers={"Retry-After": "60", "Expires": "-1",
"Location": status_query_url})
return func.HttpResponse(status_code=200)
"""
Azure Table Storage - Python Batching Example
(C) 2016 MediaRealm.com.au
Needs v0.30.0 of the Azure Storage Python SDK
https://github.com/Azure/azure-storage-python/releases/tag/v0.30.0
"""
from azure.storage.table import TableService, Entity, TableBatch
@rajata07
rajata07 / git.migrate
Created May 2, 2019 11:08 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@rajata07
rajata07 / ssh-d4m
Created May 26, 2017 11:09
SSH into Docker for Mac xhyve VM
1. screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
2. when done use CTRL-A CTRL-\ and then y (for yes) to exit
Alternative method:
1. docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
@rajata07
rajata07 / mocha-guide-to-testing.js
Created May 3, 2017 15:16 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@rajata07
rajata07 / linux_history_navigate
Created July 15, 2014 15:52
Linux History Shortcuts
Move up through the command history list ^P
one command at a time.
Move down through the command history list ^N
one command at a time.
Run the previous command. !!
Run command number n !n
@rajata07
rajata07 / 0_reuse_code.js
Created July 4, 2014 08:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console