Skip to content

Instantly share code, notes, and snippets.

🥔
potatoes?

Prashant Sinha prashnts

🥔
potatoes?
Block or report user

Report or block prashnts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@prashnts
prashnts / asyncdownload.py
Created Feb 15, 2017
Asyncio Python -- Download in parallel
View asyncdownload.py
import aiohttp
import asyncio
BATCH_SIZE = 20
POOL_SIZE = 5
async def get_content(client, url):
async with client.get(url) as response:
return await response.text()
@prashnts
prashnts / pandas_ix.py
Created Dec 21, 2016
Perf comparison when using Integer vs. String indexes in a Pandas DF
View pandas_ix.py
import pandas as pd
import numpy as np
LIM = 100000
df_i = pd.DataFrame(np.random.randint(0, 100, size=(LIM, 4)), columns=list('ABCD'), index=list(range(0, LIM)))
df_s = pd.DataFrame(np.random.randint(0, 100, size=(LIM, 4)), columns=list('ABCD'), index=list(map(hex, range(0, LIM))))
## used in ipython
>>> %timeit -n 100 df.sort_values('A')
@prashnts
prashnts / app.js
Created Oct 14, 2016
Three.js Network animation used on CIC 404 pages, such as: https://ducic.ac.in/does-not-exists
View app.js
function init() {
var e, t = 100,
n = 50,
r = 50,
i, s;
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight,
1, 1e4);
camera.position.z = 100;
scene = new THREE.Scene;
renderer = new THREE.CanvasRenderer;
View keybase.md

Keybase proof

I hereby claim:

  • I am prashnts on github.
  • I am prashnts (https://keybase.io/prashnts) on keybase.
  • I have a public key whose fingerprint is 1FE8 3C8F 39BF 06FE 8C06 2E2B 2AD4 EFE5 6AB0 6289

To claim this, I am signing this object:

@prashnts
prashnts / lodash.custom.js
Created Jan 18, 2016
An extended custom build of lodash, generated with: # lodash exports=commonjs include=assign,clone,filter,each,map,random,reduce,some
View lodash.custom.js
/**
* @license
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
* Build: `lodash exports="commonjs" include="assign,clone,filter,each,map,random,reduce,some"`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
;(function() {
View ie8_node_enum.js
var Node = Node || {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3
};
View underscore.mixin.deepExtend.js
(function() {
var arrays, basicObjects, deepClone, deepExtend, deepExtendCouple, isBasicObject,
__slice = [].slice;
deepClone = function(obj) {
var func, isArr;
if (!_.isObject(obj || _.isFunction(obj))) {
return obj;
}
if (_.isDate(obj)) {
View jquery.scrollWindowTo.js
$.scrollWindowTo = function(pos, duration, cb) {
if (duration == null) {
duration = 0;
}
if (pos === $(window).scrollTop()) {
$(window).trigger('scroll');
if (typeof cb === "function") {
cb();
}
return;
@prashnts
prashnts / indian.districts.geocoded.pincode.json
Created Dec 6, 2014
Indian District's GeoCoded Pin Code Data
View indian.districts.geocoded.pincode.json
{
"_description: Name of City, or Town": {
"State": "The Indian State under which this City/Town exists.",
"GeoCode": [
"Latitude",
"Longitude"
],
"PinCodes": [
"All",
"The",
@prashnts
prashnts / JavaScript_Cookies.js
Created Sep 21, 2014
Javascript Cookies Access Implementation.
View JavaScript_Cookies.js
// Usage: Cookie.read(name),
// Cookie.create(name, value, days),
// Cookie.erase(name)
// Author: Prashant Sinha <firstname><lastname>@outlook.com, <firstname>@ducic.ac.in
var Cookie = {
create: function(name, value, days) {
var expires;
if (days) {
You can’t perform that action at this time.