Skip to content

Instantly share code, notes, and snippets.

View anandadake's full-sized avatar

Anand Vitthal Adake anandadake

View GitHub Profile
# -*- encoding: utf-8 -*-
"""
Python Application
"""
__author__ = "[email protected]"
import os
import json
import pathlib
@anandadake
anandadake / run.py
Created February 2, 2024 05:00
Python Flask: send file from other link
import requests
def get(cls, date: str, date_end: str, office_in_charge: str):
user = get_jwt_identity()
url = "http://localhost:9090/jasperserver/rest_v2/reports/reports/interactive/DTR.pdf"
r = requests.get(url,
params={
'username': 'jasperadmin',
'password': 'jasperadmin',
'p1': user,
@anandadake
anandadake / proxy_views.py
Created February 2, 2024 04:57 — forked from joeshaw/proxy_views.py
super-hacky flask proxy
# coding:utf-8
# Copyright 2011 litl, LLC. All Rights Reserved.
import httplib
import re
import urllib
import urlparse
from flask import Blueprint, request, Response, url_for
from werkzeug.datastructures import Headers
@anandadake
anandadake / run.py
Created January 19, 2024 12:05
Flask - Subprocess - Termination : Kill process and all its child processes after a Popen
# -*- encoding: utf-8 -*-
import os
import sys
from psutil import Process
from subprocess import Popen
from flask import Flask, jsonify, current_app
app = Flask(__name__)
@anandadake
anandadake / app.component.ts
Last active January 15, 2024 06:06
Angular Automatic logout if Idle or inactive for some time using [@ng-idle/core] [sweetalert2]
import { Subscription } from 'rxjs';
import { Router } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import Swal from 'sweetalert2';
import { Idle, DEFAULT_INTERRUPTSOURCES } from '@ng-idle/core';
import { DocumentInterruptSource, StorageInterruptSource } from '@ng-idle/core';
import { Account } from './core/user/account.model';
import { LoginService } from './core/login/login.service';
@anandadake
anandadake / project-view.component.html
Created January 15, 2024 04:53
Component Code structure style
<div class="container mt-5">
<div class="row">
<div class="col-md-12">
<div class="row mb-2">
<div class="col-md-8">
<h1>{{project_info.project_name}}</h1>
</div>
<div class="col-md-2"><div class="d-grid"><button class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#makeACopyModal" (click)="onPreCopy($event)">Make a Copy</button></div></div>
<div class="col-md-2"><div class="d-grid"><button class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">Delete project</button></div></div>
</div>
@anandadake
anandadake / brush.component.ts
Created January 4, 2024 08:39
Angular Memory Leak Solution
import { catchError } from 'rxjs';
import { FormBuilder } from '@angular/forms';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-brush',
templateUrl: './brush.component.html',
@anandadake
anandadake / run.py
Created December 27, 2023 11:36
Python :: 2 factor authentication
# -*- encoding: utf-8 -*-
"""
Python Application
Author: Anand Adake ([email protected])
"""
"""
requirements
python -m pip install pyotp
@anandadake
anandadake / app.py
Last active December 15, 2023 07:43
Logging in Flask Into File: Introduction and Practical Example
# -*- encoding: utf-8 -*-
"""
python -m pip install flask
Python Application
"""
import os
from flask import Flask
from datetime import datetime
from logging.config import dictConfig
@anandadake
anandadake / app.py
Last active June 5, 2025 09:15
Convert .avi video file to .mp4 video file
"""
python -m pip install moviepy
"""
import os
from time import time
import moviepy.editor as moviepy
def convert_avi_to_mp4(avi_file_path):
# function guard