Skip to content

Instantly share code, notes, and snippets.

View nahiyan's full-sized avatar

Nahiyan Alamgir nahiyan

View GitHub Profile
#include <stdio.h>
// 1 2 3 4 5
// 1 3 4 5 -1
void deleteItem (int list[], int z, int index) {
int i = index;
while (i < z) {
if ((i + 1) < z) // if there's an item on the left
list[i] = list[i + 1];
else
#include <stdio.h>
#define W 3
#define H 2
void inputMatrix (int matrix[H][W]) {
int i, j;
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
scanf("%d", &matrix[i][j]);
}
// Copyright BDH Lab 2018
#include <iostream>
#include <string>
using std::cout;
using std::string;
// IO class
class IO {
string output;
@nahiyan
nahiyan / heroku-log
Last active December 26, 2018 17:43
2018-12-26T17:30:20.557758+00:00 app[web.1]: [2018-12-26 17:30:20 +0000] [10] [INFO] Worker exiting (pid: 10)
2018-12-26T17:30:20.860732+00:00 app[web.1]: [2018-12-26 17:30:20 +0000] [4] [INFO] Shutting down: Master
2018-12-26T17:30:20.861125+00:00 app[web.1]: [2018-12-26 17:30:20 +0000] [4] [INFO] Reason: Worker failed to boot.
2018-12-26T17:30:21.089174+00:00 heroku[web.1]: State changed from up to crashed
2018-12-26T17:30:21.069711+00:00 heroku[web.1]: Process exited with status 3
2018-12-26T17:30:21.000000+00:00 app[api]: Build succeeded
2018-12-26T17:30:35.331409+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cirrhus.herokuapp.com request_id=962f35a8-2378-419b-bbb4-cd8f6b6219e5 fwd="103.195.204.5" dyno= connect= service= status=503 bytes= protocol=https
2018-12-26T17:30:36.799912+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/apple-touch-icon-precomposed.png" host=cirrhus.herokuapp.com request_id=e4fde1f8-856a-41c3-96a2-c12bd405681c fwd="

Overview

  1. Our main goal is to use django to create a project.
  2. Since, django is a python framework, we need to install python to run it.
  3. However, there are 2 major versions of python available - python 2 and python 3.
  4. We're going to use python 3 since it's the latest version available and is way better than python 2.
  5. Pip is the package manager for python, we use pip to install python programs so we don't have to download, configure and install it ourselves.
  6. Managing python versions (2 and 3) is a bit tedious, so we're going to use virtualenv.
  7. Virtualenv will help us create isolated environment for our django project so we can set which python version we're going to use and not worry about anything at all. There are many other benefits of using it which you'll see later.
@nahiyan
nahiyan / lyrics.md
Last active February 1, 2019 08:54
Song

Verse 1

From time to time, I wonder how, how it all began, how it all prevailed

I think about you and your smile, I have embedded in my mind

From the night we first met each other, to the day we’re in today

Nights go and days come, I can't wait to live with you

@nahiyan
nahiyan / purity-haskell-freenode
Last active May 13, 2019 10:34 — forked from robstewart57/purity-haskell-freenode
Confusion about analogy's of purity in Haskell
[18:27] <trumanshow19> Would someone mind help iron out the
inconsistencies in my head with respect to purity in
Haskell. Statement 1: Haskell is a purely functional lanugage, S2:
Haskell is not impure, but... S3: f :: a -> a is a "pure" function as
opposed to a -> IO a.
[18:27] <trumanshow19> If a -> is pure, to distinguish a -> IO a, then
how do I describe the latter, is there is no impurity in Haskell ?
[18:28] <trumanshow19> The only opposite of pure I know is impure.
@nahiyan
nahiyan / readme.md
Created June 30, 2019 15:59
Java References and Passing Arguments

Introduction

Java supports references, but it doesn't allow pass by references. Here, we're going to play with Java to understand the concepts better.

References

Let's think of a simple object, such as a string:

String name = "Paul Stanley";
import cv2
import imutils
import numpy as np
import pytesseract
from PIL import Image
def wait():
cv2.waitKey(0)
cv2.destroyAllWindows()
@nahiyan
nahiyan / tiv_error.md
Last active September 10, 2020 05:23
TIV error with JPEG image

TIV failed to work for me when I tried to use it to view a JPEG image. Giving me this error when I tried to view a JPEG image:

[CImg] *** CImgIOException *** [instance(0,0,0,0,(nil),non-shared)] CImg<unsigned char>::load(): Failed to recognize format of file 'raw_images/9.jpg'.

Here are the details of that file:

raw_images/9.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=10, height=0, manufacturer=RaspberryPi, model=RP_imx219, xresolution=156, yresolution=164, resolutionunit=2, datetime=2019:08:03 11:11:14, width=0], baseline, precision 8, 1280x720, components 3