Skip to content

Instantly share code, notes, and snippets.

View prashnts's full-sized avatar
🥔
potatoes?

Prashant Sinha prashnts

🥔
potatoes?
View GitHub Profile
@prashnts
prashnts / asyncdownload.py
Created February 15, 2017 08:00
Asyncio Python -- Download in parallel
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 / component.jsx
Created August 26, 2020 05:58
Blueprintjs Pagination component example
import React, { Component } from 'react'
import { Button, Intent } from '@blueprintjs/core'
const CELL_COUNT = 7
const CELL_MID_LEN = ~~(CELL_COUNT / 2)
class Pagination extends Component {
// This component implements pagination buttons such as these:
// ┌───┬───┬───┬───┬───┐
blueprint:
name: Ikea Styrbar Remote over Z2M
description: Control your lights with the IKEA STYRBAR remote. You can also set actions for the left and right button.
domain: automation
input:
transition_time:
name: Transition time
description: Transition time for the target lights in seconds
selector:
number:
blueprint:
name: Enki Remote over Z2M
description: Blueprint for Enki RGB Remote over Z2M
domain: automation
input:
remote:
name: Remote
description: The action entity of your Enki Remote
selector:
entity: