Skip to content

Instantly share code, notes, and snippets.

Avatar

Ahmedur Rahman Shovon arsho

View GitHub Profile
View hackerearth_counting_inversions.cpp
#include <bits/stdc++.h>
using namespace std;
long merge_sorted_arrays(long ar[], long temp[], long left, long mid, long right) {
long inversion_count = 0;
long left_pos = left;
long right_pos = mid + 1;
long current_pos = left;
while (left_pos <= mid && right_pos <= right) {
if (ar[left_pos] <= ar[right_pos]) {
@arsho
arsho / fix_ethernet.md
Created Jan 18, 2021
Fixed unmanaged ethernet connection in Ubuntu 20.10
View fix_ethernet.md

Scenario

  • In Ubuntu the Ethernet connection was shown as unmanaged wired connection.
  • This happened after using sudo pppoeconf to configure a pppoeconfiguration.

Solution

  • Open /etc/NetworkManager/NetworkManager.conf with sudo previlege:
sudo gedit /etc/NetworkManager/NetworkManager.conf
  • Change the line managed=false to managed=true
@arsho
arsho / dell_logo_freeze_ubuntu.md
Created Jan 10, 2021
Solution to Ubuntu 20.04 LTS Dell logo freeze screen
View dell_logo_freeze_ubuntu.md

Solution to: Stuck on Dell logo in Dual Boot Dell Machine

Machine Information:

  • Model: Dell G5 5587
  • Processor: Intel core i7-8750H
  • Ram: 16GB
  • Graphics: NVIDIA 1060 GeForce GTX 1060 Mobile
  • SSD: 256GB
  • HDD: 1TB
@arsho
arsho / fix_nvidia_driver_ubuntu_20.04.md
Last active Nov 6, 2020
Ubuntu 20.04 Upgrade nVidia graphics card issue.
View fix_nvidia_driver_ubuntu_20.04.md

Scenario

  • Upgraded to Ubuntu 20.04 from Ubuntu 18.04
  • Previously the graphics card was shown nVidia in Ubuntu about section
  • Now its llvmpipe (LLVM 10.0.0, 256 bits) / llvmpipe (LLVM 10.0.0, 256 bits)

Solution

  • Install all necessary drivers:
sudo ubuntu-drivers autoinstall
@arsho
arsho / allocation_solution_using_counting_sort.py
Created Aug 9, 2020
Google Kick Start 2020 - Round A: Allocation (5pts, 7pts). Time complexity: O(N) for counting sort and O(NlogN) for default sort.
View allocation_solution_using_counting_sort.py
def get_sorted_values(values):
occurrences = [0] * 1001
sorted_values = [0]*len(values)
for value in values:
occurrences[value] += 1
for i in range(1, 1001):
occurrences[i] += occurrences[i-1]
for i in range(len(values)-1, -1, -1):
sorted_values[occurrences[values[i]]-1] = values[i]
occurrences[values[i]] -= 1
@arsho
arsho / dataframe.md
Last active Jul 15, 2020
Stackoverflow suggestions for new questions
View dataframe.md
View database_value.txt
"<div id=\"54d74ae1-aaa7-4169-8e43-f2c254126761\" class=\"plotly-graph-div\" style=\"height:600px; width:900px;\"></div>\n <script type=\"text/javascript\">\n$(document).ready(function(){\n window.PLOTLYENV=window.PLOTLYENV || {};\n\n if (document.getElementById(\"54d74ae1-aaa7-4169-8e43-f2c254126761\")) {\n Plotly.newPlot(\n '54d74ae1-aaa7-4169-8e43-f2c254126761',\n [{\"marker\": {\"color\": \"black\", \"size\": 4}, \"mode\": \"markers\", \"name\": \"Actual\", \"type\": \"scatter\", \"x\": [\"2020-03-18T00:00:00\", \"2020-03-19T00:00:00\", \"2020-03-20T00:00:00\", \"2020-03-21T00:00:00\", \"2020-03-22T00:00:00\", \"2020-03-23T00:00:00\", \"2020-03-24T00:00:00\", \"2020-03-25T00:00:00\", \"2020-03-26T00:00:00\", \"2020-03-27T00:00:00\", \"2020-03-28T00:00:00\", \"2020-03-29T00:00:00\", \"2020-03-30T00:00:00\", \"2020-03-31T00:00:00\", \"2020-04-01T00:00:00\", \"2020-04-02T00:00:00\", \"2020-04-03T00:00:00\", \"2020-04-04T00:00:00\", \"2020-04-05T00:00:00\", \"2020-04-06T00:00
View body_include.html
<script src="https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.51.1/plotly.min.js" integrity="sha256-qe/oN+ddr+wOzXyDWGSx8glJYbdQk2FwExwyQgNMsdQ=" crossorigin="anonymous"></script>
<script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
<div id="54d74ae1-aaa7-4169-8e43-f2c254126761" class="plotly-graph-div" style="height:600px; width:900px;"></div>
<script type="text/javascript">
$(document).ready(function(){
<?php echo $db->variable ?>
})
</script>
<!---->
@arsho
arsho / day_1_LinearRegressionOnLinearEquation.html
Created Apr 11, 2020
Tensorflow Basic Linear Regression on Linear Equation
View day_1_LinearRegressionOnLinearEquation.html
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="Ahmedur Rahman Shovon">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Tensorflow Basic Linear Regression on Linear Equation</title>
@arsho
arsho / extract_table.js
Created Apr 10, 2020
Extract features and generate readme list from https://www.django-cms.org/en/features/list/
View extract_table.js
$count_section = 1;
$count_subsection = 1;
$self_service = "Self service";
$third_party = "Via add-ons or third-party services";
$final_string = "";
$(".table tr").each(function(item, data){
$tr = $(this);
if($tr.attr("class") == "active"){
$section_title = $tr.children("td:first").text();
$final_string += $count_section+". #### "+$section_title+":"+"\n";