Skip to content

Instantly share code, notes, and snippets.

View arundhaj's full-sized avatar

Arunkumar Dharuman arundhaj

View GitHub Profile
@arundhaj
arundhaj / main.py
Created January 29, 2022 11:31
AWS S3 Presigned URL for upload and download
from pprint import pprint
import boto3
session = boto3.Session(profile_name='arundhaj')
s3_client = session.client('s3')
s3_bucket_name = 'codepossibility-presigned'
object_name = 'TestUploadFile.txt'
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import select, insert, update, delete
from sqlalchemy.exc import SQLAlchemyError
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///todo.sqlite3'
db = SQLAlchemy(app)
@arundhaj
arundhaj / certificate.cnf
Created June 20, 2021 06:06
Using Angular CLI and self-signed SSL Certificate to serve over HTTPS in localhost
[req]
default_bits = 2048
prompt = no
default_md = sha256
x509_extensions = v3_req
distinguished_name = dn
[dn]
C = IN
ST = India
@arundhaj
arundhaj / app.py
Last active June 27, 2022 12:03
Documenting Flask REST APIs with Swagger Specification and Swagger UI
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
from flask import Flask, jsonify, render_template, send_from_directory
from marshmallow import Schema, fields
from werkzeug.utils import secure_filename
app = Flask(__name__, template_folder='swagger/templates')
@arundhaj
arundhaj / fileoperation.groovy
Last active December 11, 2015 12:38
to perform file operation
File f = new File("helloworld.txt")
FileOutputStream fos = new FileOutputStream(historyFile, true)
DataOutputStream dos = new DataOutputStream(fos)
BufferedWriter bw = new BufferedWriter((new OutputStreamWriter(dos)))
Date today = new Date()
for(int i = 10; i >= 0; i--) {
Date anotherDay = new Date()