Skip to content

Instantly share code, notes, and snippets.

View bhavishyagopesh's full-sized avatar

BHAVISHYA bhavishyagopesh

View GitHub Profile
@bhavishyagopesh
bhavishyagopesh / Course.sol
Created March 17, 2019 00:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity 0.5.1;
contract Course {
address admin;
address ManagerContract;
address instructor;
int courseNo;
struct Marks{
@bhavishyagopesh
bhavishyagopesh / Course.sol
Created March 17, 2019 00:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity 0.5.1;
contract Course {
address admin;
address ManagerContract;
address instructor;
int courseNo;
struct Marks{
FROM centos
RUN yum -y localinstall https://www.linuxglobal.com/static/blog/pdftk-2.02-1.el7.x86_64.rpm
WORKDIR /test
VOLUME ["/test"]
@bhavishyagopesh
bhavishyagopesh / plugin_dep.py
Last active February 8, 2018 07:22
Dep_binary
import ctypes
import os
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from commoncode import system
from commoncode import command
@bhavishyagopesh
bhavishyagopesh / pappusth.py
Last active September 4, 2017 01:15
To verify `Pappus Theorem`.
"""In mathematics, Pappus's hexagon theorem (attributed to Pappus of Alexandria) states that given one set of
collinear points A, B, C, and another set of collinear points a, b, c, then the intersection points X, Y, Z of
line pairs Ab and aB, Ac and aC, Bc and bC are collinear, lying on the Pappus line.
"""
from sympy import *
from sympy.geometry import *
l1 = Line(Point(0, 0), Point(5, 6))
l2 = Line(Point(0, 0), Point(2, -2))
@bhavishyagopesh
bhavishyagopesh / quads.py
Created September 4, 2017 00:18
Hiererachy of quadrilaterals
class trapezium():
"""
Trapezium class that takes three parameters two of it's
parallel sides(a & b) and height(h)
>>> t1 = trapezium(2,2,4)
>>> t1.area
8

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@bhavishyagopesh
bhavishyagopesh / bm_smtplib.py
Last active August 19, 2017 08:44
Benchmark smtplib module.
"""
Benchmark smtplib module.
"""
# This benchmark requires a running smtp service on port 25
# For Eg: PostFix
import perf
from six.moves import xrange
import smtplib
py3 | py2
|
0.578 {method 'read' of '_io.TextIOWrapper' objects} | 0.566 {method 'read' of 'file' objects}
.007 decimal.py | 0.001 decimal.py
0.003 threading.py |
0.001 enum.py |
0.002 signal.py |
0.002 decoder.py |
0.002 tokenize.py |
0.001 sre_compile.py |
# server code
from fib import fib
from socket import *
def fib_server(address):
# This sets up the socket(you can think that of as pipe over which communication happens) object
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
# It binds to the address and listens for any connections