Skip to content

Instantly share code, notes, and snippets.

@sithu
sithu / simple-redux.js
Created March 5, 2018 22:12
Redux Example
const print = console.log;
const actions = [
{ type: 'ADD', value: 1 },
{ type: 'SUBTRACT', value: 2 },
{ type: 'ADD', value: 3 },
{ type: 'SUBTRACT', value: 4 },
{ type: 'ADD', value: 5 },
]
@sithu
sithu / UdpServer.kt
Created November 29, 2017 09:29 — forked from codingtim/UdpServer.kt
Simple udp server with netty 4.1 and kotlin
import io.netty.bootstrap.Bootstrap
import io.netty.channel.ChannelHandlerContext
import io.netty.channel.SimpleChannelInboundHandler
import io.netty.channel.nio.NioEventLoopGroup
import io.netty.channel.socket.nio.NioDatagramChannel
import io.netty.util.CharsetUtil
import io.netty.util.concurrent.DefaultThreadFactory
import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.experimental.newFixedThreadPoolContext
@sithu
sithu / Ubuntu1604py36Dockerfile
Created September 29, 2017 05:51 — forked from monkut/Ubuntu1604py36Dockerfile
Base Docker image for ubuntu-16.04 & Python3.6
# docker build -t ubuntu1604py36
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y software-properties-common vim
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv
RUN apt-get install -y git

https://www.linuxbabe.com/ubuntu/install-linux-kernel-4-10-ubuntu-16-04-ukuu

http://old-releases.ubuntu.com/releases/16.04.2/ https://en.wikipedia.org/wiki/Ubuntu_version_history#Table_of_versions http://www.omgubuntu.co.uk/2016/10/download-ubuntu-16-10-new-features

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-headers-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-headers-4.8.0-040800_4.8.0-040800.201610022031_all.deb
@sithu
sithu / q2.py
Created August 31, 2017 03:35
Quizz 2 Baseline
import requests
def http_call_sync():
r = requests.get('https://httpbin.org/status/200')
print(r.status_code)
r = requests.get('https://httpbin.org/status/204')
print(r.status_code)
def http_call_async():
@sithu
sithu / latency.py
Last active February 4, 2018 05:15
In-class Exercise 1
"""
Question:
Pick one IP from each region, find network latency from via the below code snippet
(ping 3 times), and finally sort the average latency by region.
http://ec2-reachability.amazonaws.com/
Expected Output for all 15 regions:
1. us-west-1 [50.18.56.1] - 100ms (Smallest average latency)
2. xx-xxxx-x [xx.xx.xx.xx] - 200ms
3. xx-xxxx-x [xx.xx.xx.xx] - 300ms
0x0006eC2E5Ca955d38cA133FBf440DDFab050804e
chain: ropsten
# Use automated Chrome to verify all contracts on etherscan.io
# You need to install Splinter package:
# pip install splinter
verify_on_etherscan: no
browser_driver: chrome
contracts:
chain: ropsten
# Use automated Chrome to verify all contracts on etherscan.io
# You need to install Splinter package:
# pip install splinter
verify_on_etherscan: no
browser_driver: chrome
contracts:
0x0c8cf01ae70831ac018160ffeedf2033b3364d7d