Skip to content

Instantly share code, notes, and snippets.

View sujitmhj's full-sized avatar

Sujit Maharjan sujitmhj

View GitHub Profile
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
{"variable_name":"account_name", "display_name":"Account Name", "hint":"Name of organisation or company"},
{"variable_name":"account_type","display_name":"Account Type", "hint":"Name of the vertical"},
{"variable_name":"account_sub_type","display_name":"Account Sub Type","hint":"Name of sub vertical"},
{"variable_name":"website","display_name":"Website", "hint":"Website of the organisation"},
{"variable_name":"phone","display_name":"Phone", "hint":"Phone number of organisation"},
{"variable_name":"email","display_name":"Email", "hint":"Email of the organisation"},
{"variable_name":"fax","display_name":"Fax", "hint":"Fax of the organisation"},
{"variable_name":"data_source","display_name":"Data Source", "hint":"Data source alias Like manta Schools"},
{"variable_name":"data_source_url", "display_name":"Data source URL", "hint":"Url link from where data is scrapped"},
{"variable_name":"street", "display_name":"Street", "hint":"Street Address of the organisation"},
import os
from os.path import join, dirname
import sys
import csv
def start_import():
project_path = join(os.path.dirname(__file__), '../' 'database')
sys.path.append(project_path)
platforms = {}
with open('graphite.csv') as csvfile:
If you have Ubuntu based server
1) Run in console of the server
>> crontab -e
2) Then you will see list of cron job in a text editor, you need to add following line at the end
>> * * * * * cd <path to the file directory> && /usr/bin/python channel.py
Example: if your path is /srv/www/public_html/youtube/
Then, you need to append following line and save it:
@sujitmhj
sujitmhj / Steps to install api server.
Created February 21, 2018 11:34
API Server installation guide.
Follow these steps to install the api server.
Steps:
1) Install Nginx, php7.2, and php7.2-fpm
2) Go to project directory and run `composer install` to install dependencies
3) Install php-mongo driver
4) Configure __project_directory__/vendors/amember/application/configs/config.php
5) Add api server configuration in __project_directory__/.env file. You can use .env.example as template
6) Run `php artisan migrate` for migration
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
[{'NOTES': {}, 'PART_1': {'ORGANIZATION': '1', 'ORGANIZATION_OTHERS': '', 'TRAINED_MASONS': '1', 'TYPE_OF_SOIL': '1', 'TECHNICAL_SUPPORT': '1'}, 'PHOTOS': {'PHOTO_2': '3', 'HOUSE_PLAN_NAME': '', 'PHOTO_4': '3', 'PHOTO_1': '3', 'PHOTO_3': '3', 'PHOTO_1_NAME': '36-20-1-0-60_00000016_front.jpg', 'PHOTO_3_NAME': '36-20-1-0-60_00000016_left.jpg', 'PHOTO_OF_HOUSE_PLAN': '3', 'PHOTO_4_NAME': '36-20-1-0-60_00000016_right.jpg', 'PHOTO_5': '3', 'PHOTO_5_NAME': '36-20-1-0-60_00000016_top.jpg', 'PHOTO_2_NAME': '36-20-1-0-60_00000016_back.jpg'}, 'APPLICATION_RECORD': {'WHICH_INSPECTION': '2', 'DATE_OF_APPLICATION': '2074-12-01'}, 'FORM_NUMBER': '00000016', 'PART_2': {'NO1_F': '1', 'NO1_B': '1', 'NO1_D': '1', 'NO1_A': '1', 'NO1_G': '1', 'NO1_C': '1', 'NO1_E': '1'}, 'GPS_DATA': {'LONGITUDE': '', 'GPS_TAKEN': '2', 'ALTITUDE': '', 'LATITUDE': ''}, 'FINAL_APPROVAL': {'MOUD_DLPIU_ENGINEER_2': '', 'RELATIONSHIP_TO_HOUSE_OWNER': 'self', 'ENGINEER_POST': '2', 'HOUSE_OWNER_S_NAME': 'Nar Bahadur Khanal', 'ACCEPT_THE_ENTRY': '1', 'FI
['22-9-2-0-49',
'G-22-9-2-0-018',
'22-9-3-0-5',
'22-9-2-0-38',
'22-9-3-0-17',
'29-9-3-0-77',
'G-22-9-6-0-007',
'28-47-4-0-55',
'24-5-7-0-26',
'28-47-5-0-12',
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def check_triangle(numbs):
total = sum(numbs)
for i in range(3):
item = numbs[i]
two_sum = total - item
if item >= two_sum:
return False
return True