This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import requests | |
| from bs4 import BeautifulSoup | |
| def initDataFile(): | |
| with open('data.csv', 'wb') as fp: | |
| writer = csv.writer(fp, delimiter = ',') | |
| header = ['Name', 'Address', 'Email', 'Mobile No', 'University Name', 'Division Name', 'National ID No./Birth Registration No.', 'Date of Birth', 'Attend 5 days Training', '1st Preferred Training Venue', '2nd Preferred Training Venue', '3rd Preferred Training Venue', 'Status'] | |
| writer.writerows([header]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \curl -L https://get.rvm.io | bash -s stable && source ~/.rvm/scripts/rvm && rvm requirements && rvm install ruby && rvm use ruby --default && rvm rubygems current && gem install rails && sudo apt-get install nodejs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #try to compile the file | |
| gcc -lm main.c -o main | |
| #if compile successful then go on | |
| if [[ $? = 0 ]]; then | |
| #try to run program with time limite | |
| timeout 1s ./main < input.txt | |
| RV=$? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pprint | |
| import requests | |
| from bs4 import BeautifulSoup | |
| ''' | |
| JSON Format: {"Dhaka":{"Motijheel":{"BangabhabanTSO":"1222","DilkushaTSO":"1223"}}} | |
| ''' | |
| url_list = { | |
| 'Barisal': 'http://www.bangladeshpost.gov.bd/PostCodeList.asp?DivID=1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #install postgres | |
| sudo apt-get update | |
| sudo apt-get upgrade | |
| sudo apt-get -y install postgresql-9.5 python-psycopg2 | |
| #install postgis | |
| sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt xenial-pgdg main" >> /etc/apt/sources.list' | |
| wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
| sudo apt-get update | |
| sudo apt-get install postgresql-9.5-postgis-2.2 postgresql-contrib-9.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| class Subject(models.Model): | |
| name = models.CharField(max_length=128) | |
| class Student(models.Model): | |
| name = models.CharField(max_length=128) | |
| subjects = models.ManyToManyField(Subject, through='StudentSubject') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ProductPrice(models.Model): | |
| product = models.ForeignKey('Product', on_delete=models.CASCADE,) | |
| price = models.DecimalField(max_digits=10, decimal_places=2) | |
| date = models.DateField() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None): | |
| """ | |
| Decorator for views that checks that the user is logged in, redirecting | |
| to the log-in page if necessary. | |
| """ | |
| actual_decorator = user_passes_test( | |
| lambda u: u.is_authenticated, | |
| login_url=login_url, | |
| redirect_field_name=redirect_field_name | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def foo(a, b): | |
| return a+b | |
| foo(1, 3) ---> 4 | |
| foo ---------> <function foo at 0x7f71d73105f0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| import requests | |
| import xml.etree.ElementTree as ET | |
| POST_URI = 'http://116.212.108.236:802/PaymentServices.asmx?op=PaymentRequestFromECom' | |
| user_id = 'ecomauser' | |
| password = 'itreus#7102' | |
| vendor_code = 'GP' | |
| phone_number = '01989782605' | |
| post_or_pre = 1 |
OlderNewer