Skip to content

Instantly share code, notes, and snippets.

View NihalHarish's full-sized avatar

Nihal Harish NihalHarish

  • Robinhood
  • Palo Alto, CA
View GitHub Profile
@NihalHarish
NihalHarish / two_file_writers.py
Created November 1, 2019 00:24
Two Filewriters Test
import os
file_name_1 = "test_file_1.txt"
file_name_2 = "test_file_2.txt"
f1 = open(file_name_1, "w+")
f2 = open(file_name_1, "w+")
f1.write("I am F1\n")
@NihalHarish
NihalHarish / fn_test.py
Created October 4, 2019 23:33
Call Member Functions in Constructor
class FirstTest:
def __init__(self):
self.name = self.get_name()
def show_name(self):
return self.name
def get_name(self):
return "Pingoo"
@NihalHarish
NihalHarish / make_dir_test.py
Created October 1, 2019 21:37
Test to check thread and process safety of the makedirs function in python3
from multiprocessing import Process
import threading
import os
DIRECTORY = 'experiment'
def create_file(_id):
os.makedirs(DIRECTORY, exist_ok=True)
@NihalHarish
NihalHarish / tup_dict_perf_test.py
Created August 24, 2019 06:20
Tuple v/s Dict Performance
import time
import random
TEST_RUNS = 5000000
def dict_performance_write():
start = time.time()
data = []
start = time.time()
@NihalHarish
NihalHarish / ptb_xx.py
Created November 7, 2018 06:18
model parallelism
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@NihalHarish
NihalHarish / ptb_xx.py
Created November 7, 2018 06:18
model parallelism
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@NihalHarish
NihalHarish / ptb_xx.py
Created November 7, 2018 06:18
model parallelism
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@NihalHarish
NihalHarish / ptb_xx.py
Created November 7, 2018 06:18
model parallelism
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@NihalHarish
NihalHarish / ptb_xx.py
Created November 7, 2018 06:18
model parallelism
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@NihalHarish
NihalHarish / ptb_xx.py
Created November 7, 2018 06:18
model parallelism
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,