Skip to content

Instantly share code, notes, and snippets.

@amitkot
amitkot / colorful_list.dart
Created March 4, 2020 10:57
A Colorful list widget for debugging
class YYY extends StatelessWidget {
YYY({bloc, @required this.iconData});
final IconData iconData;
static final r = Random();
final colors = [
for (final _ in range(100))
Color.fromARGB(
r.nextInt(256), r.nextInt(256), r.nextInt(256), r.nextInt(256)),
@amitkot
amitkot / main.dart
Created October 23, 2019 11:00
An example of a page that does expensive work when recreated every time the keyboard pops on and off
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: MyHomePage());
}
}
@amitkot
amitkot / latency.markdown
Created July 3, 2019 20:08 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@amitkot
amitkot / Android Privacy Policy Template
Created July 1, 2019 21:24 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@amitkot
amitkot / mgn_locked_balances_of_dxmm.ipynb
Created June 10, 2019 08:45
MGN locked balances for DXMM instances
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amitkot
amitkot / main.py
Created May 16, 2019 13:37
Print historic currency conversion rates #forex #python #util
import datetime
from forex_python.converter import CurrencyRates
def print_rates(
currency_from,
currency_to,
start_year,
start_month,
start_day,
const Web3 = require('web3')
const web3 = new Web3(
new Web3.providers.HttpProvider('https://rinkeby.infura.io')
)
const ABI =
'[{"constant":false,"inputs":[{"name":"alerter","type":"address"}],"name":"removeAlerter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"sellToken","type":"address"},{"name":"buyToken","type":"address"}],"name":"claimAuctionTokens","outputs":[{"name":"sellerFunds","type":"uint256"},{"name":"buyerFunds","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"}],"name":"withdrawFromDx","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"amount","type":"uint256"}],"name":"addFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs"
@amitkot
amitkot / deployer.js
Created January 30, 2019 18:50
Kyber DutchX Market Maker Bot deployer
#!/usr/bin/env node
const Web3 = require('web3')
const fs = require('fs')
const path = require('path')
const RLP = require('rlp')
const BigNumber = require('bignumber.js')
process.on('unhandledRejection', console.error.bind(console))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amitkot
amitkot / python-es6-comparison.md
Created December 26, 2018 20:13 — forked from revolunet/python-es6-comparison.md
# Python VS ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math