Skip to content

Instantly share code, notes, and snippets.

View rana-ahmed's full-sized avatar

Minuddin Ahmed Rana rana-ahmed

View GitHub Profile
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])
\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
@rana-ahmed
rana-ahmed / compile.sh
Created September 20, 2015 13:38
A simple bash script to compile, run and compare result file to judge result file for C programming language
#!/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=$?
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',
@rana-ahmed
rana-ahmed / gis.sh
Created February 18, 2017 05:22
Install postgres gis
#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
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')
class ProductPrice(models.Model):
product = models.ForeignKey('Product', on_delete=models.CASCADE,)
price = models.DecimalField(max_digits=10, decimal_places=2)
date = models.DateField()
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
)
def foo(a, b):
return a+b
foo(1, 3) ---> 4
foo ---------> <function foo at 0x7f71d73105f0>
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