Skip to content

Instantly share code, notes, and snippets.

View armsp's full-sized avatar
👋

Shantam Raj armsp

👋
View GitHub Profile
@armsp
armsp / download pdf.py
Created May 12, 2018 05:00
Script that automates downloads of a certain set of pdf documents from http://www.ti.com/analog-circuit/circuit-cookbook.html
# pdf File downloader for TI Links
from bs4 import BeautifulSoup
import requests
import urllib3
import re
import os
DOWNLOAD_FOLDER = os.path.join("D:",os.sep,"electronics","TI_pdfs")
os.mkdir(DOWNLOAD_FOLDER)
@armsp
armsp / Class_File_Upload.py
Last active June 11, 2020 08:20
Upload files to flask restful server in two different ways. First is a proper upload and the other copies file from a given location to server's location by only providing the file path of file to copy in the URL itself.
import os
from flask import Flask, Response, request, jsonify, redirect, send_from_directory
from flask_restful import Api, Resource
from werkzeug.utils import secure_filename
class file_operation:
def __init__(self):
self.APP_ROOT = os.path.dirname(os.path.abspath(__file__))
self.UPLOAD_FOLDER = os.path.join(self.APP_ROOT, 'upload_folder_logreg')
self.ALLOWED_EXTENSIONS = set(['txt', 'csv'])
@armsp
armsp / script.py
Created May 6, 2018 07:29
Automate certificate conversion from .cer to .pem via openssl using Python. An automated solution for Docker issue error x509: certificate signed by unknown authority
import os
path = "C:/Users/username/path/to/your/folder"
file_list = os.listdir(path)
file_list_no_extension = [os.path.splitext(x)[0] for x in file_list]
for i,j in zip(file_list,file_list_no_extension):
command_list = []
command1 = "openssl x509 -inform der -in "
command2 = " -out "
command3 = ".pem"
command_list.append(command1)
@armsp
armsp / doublyLinkedList.c
Last active May 9, 2018 18:16
Doubly linked list implemented in C without any global variables.
#include <stdio.h>
#include <stdlib.h>
#include "doublyLinkedList.h"
Node* createnode(){
Node* node = malloc(sizeof(*node));
return node;
}
void addNode(Node** head, int info){