Skip to content

Instantly share code, notes, and snippets.

View orsenthil's full-sized avatar
🏠
Working from home

Senthil Kumaran orsenthil

🏠
Working from home
  • San Francisco
View GitHub Profile
@orsenthil
orsenthil / production.py
Created September 12, 2017 20:40
Using Mock
class Production:
def call_one(self, arg1, arg2):
return arg1 + arg2
def call_two(self, arg1, arg2, arg3):
return self.call_one(str(arg1), str(arg2) + str(arg3))
$ make
centos-7 -> FROM centos:7
coreos -> FROM jess/coreos
debian-jessie -> FROM debian:jessie
fedora-23 -> FROM fedora:23
ubuntu-xenial -> FROM ubuntu:xenial
+ Building the centos-7 base image
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM centos:7
---> 8140d0c64310
import socket
import threading
class ThreadedServer(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
import numpy as np
total = 1052
k = 10
indices = np.arange(total)
np.random.shuffle(indices)
indices = indices.tolist()
start = 0
from itertools import permutations
def diff(a, b):
return abs(a - b) - 1
def all_different(indices):
first, second, third, fourth, fifth = indices
size = len({diff(first, second), diff(first, third), diff(first, fourth), diff(first, fifth),
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
pushd /tmp
echo "Installing Python"
curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xvf Python-3.6.0.tgz
cd Python-3.6.0
./configure --prefix=$HOME/python36
make && make install
popd
pushd /tmp
import re
RE_PATTERNS= re.compile(r"^#(\d+)|^Issue\s#(\d+)|^Issue#(\d+)", flags=re.MULTILINE | re.IGNORECASE)
test_messages = [
"""#123""",
"""Issue #123""",
"""Issue#123"""
]