Skip to content

Instantly share code, notes, and snippets.

View arsho's full-sized avatar

Ahmedur Rahman Shovon arsho

View GitHub Profile
@arsho
arsho / Ubuntu_Virtualenv_data_science.txt
Created December 25, 2016 05:28
Installation process of data science libraries in Ubuntu
Before Installation
=========================
#To generate graph in png format,
#Install following dependent packages
sudo apt-get install libpng-dev
sudo apt-get install libfreetype6-dev
#TkAgg for the TkInter windowing system
sudo apt-get install tcl-dev tk-dev python-tk python3-tk
@arsho
arsho / DATAMATE_COLOR.TXT
Last active August 11, 2019 03:30
Datamate Color in RGB
RED: RGB(169,68,66), #a94442
BLUE: RGB(10,40,72), #0A2848
@arsho
arsho / global_variable_express.js
Last active January 13, 2017 09:54
This little script saves a global variable in express js. It count how many times an user visit the root of the website which is in this case http://localhost:3000/
var express = require("express")
var app = express()
app.locals.global_value = 0;
app.get("/",function(req,res){
app.locals.global_value += 1;
res.send("<h3>Welcome!</h3>. You have visitied this page: "+app.locals.global_value+" times.");
})
app.get("*",function(req,res){
res.send("You are nowhere! Please click on this <a href=\"/\">link</a> to go to homepage.");
})
@arsho
arsho / default.php
Last active October 29, 2019 05:03
Example of PDO::ATTR_ERRMODE attribute in PDO
<?php
$server = "localhost";
$db_username = "root";
$db_password = "";
$db_name = "learn_project_db";
$conn = new PDO("mysql:host=$server;dbname=$db_name",$db_username,$db_password);
$sql_query = "SELECT * FROM wrong_user_table";
$stmt = $conn->prepare($sql_query);
$stmt->execute();
$result_set = $stmt->fetchAll();
@arsho
arsho / test_pypi.py
Last active February 22, 2017 08:48
Copyusb usecase
#sudo pip3 install copyusb
import copyusb
a = copyusb.copy()
print(a)
@arsho
arsho / email_attachments_ses_simple.php
Created February 24, 2017 01:35 — forked from sandys/email_attachments_ses_simple.php
Script to send email using Amazon SES with attachments in PHP
<?php
require("./amazon-sdk/sdk.class.php");
// on ubuntu - this script can be run using php5-cli and php5-curl
//Provide the Key and Secret keys from amazon here.
$AWS_KEY = "kkk";
$AWS_SECRET_KEY = "kkkk+xKcdkB";
//certificate_authority true means will read CA of amazon sdk and false means will read CA of OS
$CA = true;
@arsho
arsho / Django_1.11_python_2.7_ubuntu_16.04.txt
Last active December 8, 2017 09:52
Creating Virtual Environment Using Python2 in Ubuntu and using Idle inside that virtual environment
python 2.7 + django 1.11 in Ubuntu 16.04 (LTS)
================================================
# Install Python Package Installer (PIP)
sudo apt-get install python-pip
# Upgrade PIP
sudo -H pip install --upgrade pip
# Install IDLE
sudo apt-get install idle
@arsho
arsho / ordered_dict.py
Created April 3, 2017 11:03
Sorting a dictionary by value.
import collections
d={
"Apple": 5,
"Banana": 95,
"Orange": 2,
"Mango": 7
}
# sorted the dictionary by value using OrderedDict
od = collections.OrderedDict(sorted(d.items(), key=lambda x:x[1]))
print(od)
@arsho
arsho / lam.py
Last active April 13, 2017 05:31
Lambda to take input
_=lambda:list(map(int,input().split()))
x,y=_()
@arsho
arsho / hide.js
Created April 15, 2017 05:44
Hide everything except a div using jQuery
$('body > :not(#d_content_inner)').hide(); //hide all nodes directly under the body
$('#d_content_inner').appendTo('body');