Skip to content

Instantly share code, notes, and snippets.

@tanmaiaccion
tanmaiaccion / auth-cancel.json
Created September 25, 2018 08:07
auth-cancel
{
"payment_auth": [
{
"id": 1,
"instrument_token": "aaa-bb"
},
{
"instrument_token": 2,
"id": 2
},
@tanmaiaccion
tanmaiaccion / gist:d7d41b83e8442413a968f5fb5e5434f5
Last active January 8, 2019 10:52
mongo import with field types
mongoimport --port 27018 -d qanda -c qanda --type csv --fields question.string\(\),ans_1.string\(\),ans_2.string\(\),ans_3.string\(\),ans_4.string\(\),ans_5.string\(\),locationId.string\(\),status.boolean\(\) --columnsHaveTypes --file qanda.csv
@tanmaiaccion
tanmaiaccion / cloudTravel.js
Created February 6, 2019 19:20
cloudTravel
"use strict";
function PriorityQueue() {
this.collection = [];
}
PriorityQueue.prototype.enqueue = function(element) {
if (this.isEmpty()) {
this.collection.push(element);
} else {
@tanmaiaccion
tanmaiaccion / Dockerfile
Last active February 22, 2019 11:52
docker-compose example
//for nodejs
FROM node:carbon-alpine
WORKDIR /usr/src/app
COPY . .
RUN apk -U upgrade && npm install && npm install -g nodemon && rm -rf /var/cache/apk/*
EXPOSE 5000
CMD ["npm", "run", "start:dev"]
@tanmaiaccion
tanmaiaccion / statements.py
Created May 17, 2019 09:23
python problem statements
#use yield to make get calls
import requests
urls = ["https://jsonplaceholder.typicode.com/todos/1",
"https://jsonplaceholder.typicode.com/todos/2"]
#find number in a column-sorted and row-sorted 2D list
arr = [[1, 5, 9, 11],
@tanmaiaccion
tanmaiaccion / questions.txt
Created May 17, 2019 11:15
python sql questions
What will be the output of the code below? Explain your answer.
def extendList(val, list=[]):
list.append(val)
return list
list1 = extendList(10)
list2 = extendList(123,[])
list3 = extendList('a')
@tanmaiaccion
tanmaiaccion / data.csv
Created November 6, 2019 13:22
ols_reg
R&D Spend Administration Marketing Spend State Profit
165349.2 136897.8 471784.1 New York 192261.83
162597.7 151377.59 443898.53 California 191792.06
153441.51 101145.55 407934.54 Florida 191050.39
144372.41 118671.85 383199.62 New York 182901.99
142107.34 91391.77 366168.42 Florida 166187.94
131876.9 99814.71 362861.36 New York 156991.12
134615.46 147198.87 127716.82 California 156122.51
130298.13 145530.06 323876.68 Florida 155752.6
120542.52 148718.95 311613.29 New York 152211.77
@tanmaiaccion
tanmaiaccion / ChiMerge.ipynb
Created May 5, 2020 14:17 — forked from alanzchen/ChiMerge.ipynb
ChiMerge implementation in Python 3.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class ResourceNotFoundError extends Error {
constructor(...args) {
super(...args);
this.trace = args[0];
this.name = "ResourceNotFoundError";
Error.captureStackTrace(this, ResourceNotFoundError);
}
}
const getUser = (user_id) => {
@tanmaiaccion
tanmaiaccion / redirect-rule.js
Created September 2, 2020 20:08 — forked from nicosabena/redirect-rule.js
Redirect rule + webtask to do a reCaptcha after authentication
function (user, context, callback) {
// this rule requires the following configuration values:
// CAPTCHA_SECRET: a 32 bytes string that will be the shared secret between
// the rule and the webtask
// AUTH0_DOMAIN: your auth0 domain (e.g. account.auth0.com)
// CAPTCHA_REDIRECT: the URL for the webtask that will show and process CAPTCHA
// Put a specific client ID if you dont want CAPTCHA for every client
// if (context.clientID !== '[your client id]')