Skip to content

Instantly share code, notes, and snippets.

View arsho's full-sized avatar

Ahmedur Rahman Shovon arsho

View GitHub Profile
@arsho
arsho / Basic_bar_chart_matplotlib.py
Created September 20, 2016 18:06
Basic bar chart using matplotlib
import matplotlib.pyplot as plt
year = [2000,2001,2002,2003]
popu = [1.00,1.50,2.00,2.50]
y_pos = range(len(year))
plt.bar(y_pos,popu,label='Population',color='g', align='center')
plt.xticks(y_pos, year)
plt.legend()
plt.xlabel('year')
plt.ylabel('population')
plt.show()
@arsho
arsho / integer_number_validation.js
Created October 26, 2016 11:30
validation of integer number
// validation for ranging number
$('.subject_mark').on("keyup", function () {
this.value = this.value.replace(/[^0-9]/g, '');
var input_value = parseFloat(this.value);
if (isNaN(input_value)===true) {
$(this).val("0");
} else {
var max_value = parseFloat($(this).attr('max'));
if (input_value > max_value) {
$(this).val(max_value);
@arsho
arsho / mysql_data_insert.cs
Last active November 10, 2016 09:50
C# MySQL Data insertion using mysql-connector-net-5.1.7-noinstall, Visual Studio 2015.
string connetionString = null;
connetionString = "server=localhost;database=device_db;uid=root;pwd=123;";
using (MySqlConnection cn = new MySqlConnection(connetionString))
{
try
{
string query = "INSERT INTO test_table(user_id, user_name) VALUES (?user_id,?user_name);";
cn.Open();
using (MySqlCommand cmd = new MySqlCommand(query, cn))
@arsho
arsho / README.md
Created November 18, 2016 18:18 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@arsho
arsho / allow_letters_only.py
Created November 20, 2016 18:04
Using regular expression to allow only a to z and A to Z letters
import re
word = input()
if(re.match(r'^[a-zA-Z]+$',word)):
print("matched")
else:
print("not matched")
@arsho
arsho / remove_list_item.py
Created November 23, 2016 06:54
Removing a list item using remove method
a = {'pantera' : ['cemetary gates','cowboys from hell','nothing else matters']}
a["pantera"].remove('nothing else matters')
print(a)
# output: {'pantera': ['cemetary gates', 'cowboys from hell']}
@arsho
arsho / docs_mongodb.js
Last active January 5, 2017 13:09
Hide every tags of a page except one specific ID
$("body>:not(.document)").hide();
$(".document").appendTo("body");
@arsho
arsho / a.py
Created December 12, 2016 06:51
Python __name__ functionality. First run a.py file. Then run b.py file to see the difference
if __name__ == '__main__':
print("Running directly from a.py")
else:
print("a.py is imported")
# run python a.py
@arsho
arsho / e_bomb.py
Created December 14, 2016 08:03
Run the script in own risk!!!
# shared by: Protul
import subprocess
while 1:
subprocess.Popen('cmd')
@arsho
arsho / IDLE in ubuntu.txt
Created December 25, 2016 05:23
Add IDLE in open with option of a file
To set up IDLE as the default editor you'll have to make the idle.desktop file visible in the "Open with" list. To to so edit this file using sudo:
sudo gedit /usr/share/applications/idle3.desktop
And replace its content by the following lines:
[Desktop Entry]
Name=IDLE 3
Comment=Integrated DeveLopment Environment for Python3
Exec=/usr/bin/idle3 %F
Icon=/usr/share/pixmaps/idle3.xpm