Skip to content

Instantly share code, notes, and snippets.

@ishan1608
ishan1608 / fetcher.js
Created April 14, 2020 01:37
A simple module to abstract the details of fetch API for simple calls.
export class ApiError extends Error {
constructor(message) {
super(message);
this.name = 'ApiError';
}
}
export default {
fetch: (url, fetchOptions) => {
return fetch(url, fetchOptions)
@ishan1608
ishan1608 / gist:fa66c3b34f250ca0e48a3d65af9efb43
Created September 18, 2018 04:31
Posting Answers on quora
URL: https://www.quora.com/webnode2/server_call_POST?_h=PXmhlXEVsUUz6S&_m=edit
METHOD: POST
HEADERS:
:authority: www.quora.com
:method: POST
:path: /webnode2/server_call_POST?_h=PXmhlXEVsUUz6S&_m=edit
:scheme: https
accept: application/json, text/javascript, */*; q=0.01
@ishan1608
ishan1608 / gist:daee7d878c48fc06edcb56d1bc67af99
Created September 18, 2018 04:24
Quora Ask Question API Call
URL: https://www.quora.com/webnode2/server_call_POST?_h=zcNhf8gt8agBrS&_m=ask_question
METHOD: POST
HEADERS:
:authority: www.quora.com
:method: POST
:path: /webnode2/server_call_POST?_h=zcNhf8gt8agBrS&_m=ask_question
:scheme: https
accept: application/json, text/javascript, */*; q=0.01
@ishan1608
ishan1608 / httmock_test.py
Created December 6, 2017 07:44
HTTMock Example
import json
import requests
from httmock import urlmatch, HTTMock
class HTTMockTest:
def test_hook_bin(self):
@ishan1608
ishan1608 / MainActivity.java
Created April 1, 2015 06:32
Content Toggler like Gmail
....
....
public class MainActivity extends Activity {
....
....
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
....
@ishan1608
ishan1608 / app.js
Created February 8, 2015 12:18
A node.js server to set the cookies and check them.
var http = require( "http" )
var Cookies = require( "cookies" )
var keygrip = require("keygrip")
var assert = require("assert")
server = http.createServer( function( req, res ) {
var keys = keygrip(["SEKRIT2", "SEKRIT1"], 'sha256', 'hex')
var cookies = new Cookies( req, res, keys )
, unsigned, signed, tampered
@ishan1608
ishan1608 / heater.py
Last active May 2, 2024 16:28
A python script to heat your computer so that your fingers can work upon your laptop in winter.
"""Heater
A program that spawns as much number of processes as there are CPUs on the computer.
This keeps the core temprature high.
I made this so that my fingers feel more comfortable while working on my laptop during winter.
Caution : An eye should be kept on the CPU temprature so that when it is getting too hot,
the prgoram needs to be killed; else it can damage the CPU.
Author : Ishan
Email : ishanatmuzaffarpur@gmail.com
"""
@ishan1608
ishan1608 / basicScience.csv
Created October 8, 2014 00:23
A sample csv file for testing.
1 Which common chemical element has the atomic number 20? Calcium Potassium Magnesium Lithium
2 What type of paper detects acids and alkali in liquid? Litmus Paper Filter paper Hydrion Paper Proton Paper
3 What is the only metal to be liquid at room temperature? Mercury Nickel Chromium Zirconium
4 What is the chemical name of aqua fortis? Nitric Acid Hydrochloric Acid Benzoic Acid Acetic Acid
5 What is the fourth state of matter after solid and liquid and gas? Plasma Ground State Metal Flora
6 What is the chemical symbol for Plutonium? Pu Pa Po P
7 What type of acid is used in wet cell car batteries? Sulphuric Amonic Acetic Malic
8 What is the chemical symbol for chlorine? Cl Ca C Co
9 What colour is liquid nitrogen? Colourless Black Red Brown
10 Which gas is represented by the letter H on the periodic table? Hydrogen Hafmium Holmium Helium
@ishan1608
ishan1608 / vowelCounter.py
Created September 26, 2014 08:26
A simple vowel counter in python 2
def numberOfVowels(word):
counter = 0
for letter in word:
if (letter == 'a' or letter == 'e' or letter == 'i' or letter == 'o' or letter == 'u'):
counter += 1
return counter
print numberOfVowels('testing')
@ishan1608
ishan1608 / webkitGUMTest
Last active August 29, 2015 14:01
This is the test to see the availability of user media in chrome.
// The format for getting user media stream in chrome.
// navigator.webkitGetUserMedia(constraints, successCallback, errorCallback);
navigator.webkitGetUserMedia(
{
video:true
},
function(stream) {
console.log('Got a video stream');
},