This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Useful celery config. | |
app = Celery('tasks', | |
broker='redis://localhost:6379', | |
backend='redis://localhost:6379') | |
app.conf.update( | |
CELERY_TASK_RESULT_EXPIRES=3600, | |
CELERY_QUEUES=( | |
Queue('default', routing_key='tasks.#'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Running using CRONTAB: | |
1. crontab -e | |
2. * * * * * /usr/bin/python3 /home/{username}/covid_alert.py >> ~/cron.log 2>&1 | |
3. Save & Exit | |
(You can also use any other scheduler to run the script) | |
""" | |
#!usr/bin/python3 | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge(arr, l, m, r): | |
n1 = m-l+1 | |
n2 = r-m | |
L = [] | |
R = [] | |
for i in range(0, n1): | |
L.append(arr[l+i]) | |
for i in range(0, n2): | |
R.append(arr[m+1+i]) | |
i, j, k = 0, 0, l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://www.interviewbit.com/problems/largest-number/ | |
Given a list of non negative integers, arrange them such that they form the largest number. | |
For example: | |
Given [3, 30, 34, 5, 9], the largest formed number is 9534330. | |
Note: The result may be very large, so you need to return a string instead of an integer. | |
*/ | |
bool compare(string s1, string s2) | |
{ | |
string s1s2 = s1 + s2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Given a collection of intervals, you have to merge all overlapping intervals. | |
For example: Given [2,6],[5,10],[15,18], return [2,10],[15,18]. | |
Also, mark that the returned intervals list should in non-decreasing order. | |
-------------------------------------------------------------------------- | |
struct Interval { | |
int start; | |
int end; | |
}; | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
int n, m; | |
cin >> n >> m; | |
char mat[n][m]; | |
for(int i = 0; i < n; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FILE specifies which files to compile as part of the project | |
FILE = main.cpp | |
# CC specifies which compiler we're using | |
CC = g++ -std=c++11 | |
# COMPILER_FLAGS specifies the additional compilation options we're using | |
# -Wall will turn on all standard warnings | |
COMPILER_FLAGS = -Wall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <GLFW/glfw3.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
static void error_callback(int error, const char* description) | |
{ | |
fputs(description, stderr); | |
} | |
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) | |
{ | |
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef struct node{ | |
int data; | |
struct node *next; | |
}node; | |
node* insertBegin(node *head, int n) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
vector< vector <int>> g; | |
vector<bool> v; | |
// Undirected graph | |
void addEdge(int a, int b) | |
{ | |
g[a].push_back(b); |
NewerOlder