Skip to content

Instantly share code, notes, and snippets.

View armsp's full-sized avatar
👋

Shantam Raj armsp

👋
View GitHub Profile
@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){
@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 / 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 / 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 / voice.py
Last active April 3, 2023 17:47
Identifying sentences with passive voices (english) using Spacy
import spacy
from spacy.matcher import Matcher
Active = "Harry ate six shrimp at dinner.\
Beautiful giraffes roam the savannah.\
Sue changed the flat tire.\
We are going to watch a movie tonight.\
I ran the obstacle course in record time.\
The crew paved the entire stretch of highway.\
Mom read the novel in one day.\
class fish:
def __init__(self,name):
self.name = name
self.skeleton = "bones"
def swims(self):
print(self.name, "swims")
def eyes(self):
print(self.name, "has eyelids")
class salmon(fish):
@armsp
armsp / resume_upload.py
Created July 4, 2018 04:54
Resuming file uploads in flask
import hashlib
full_file = 'isd-inventory.csv'
part_file = 'isd-inventory.csv.part'
m = hashlib.md5()
with open(full_file, 'rb') as f:
for chunk in iter(lambda: f.read(128*m.block_size), b''):
m.update(chunk)
print(m.hexdigest())
@armsp
armsp / Poetry_magazines.md
Last active September 9, 2018 06:06
A list of curated magazines that accept poetry. Work in progress.

Poetry Foundation

  • Year round submissions
  • Provide handsome compensation
  • Submissions
  • Response Time : 7 months

VQR

  • Peading Period: July 1-31
  • Very handsome Compensation
  • Submissions
@armsp
armsp / docker-compose.yaml
Last active September 16, 2018 19:03
Experiments with docker-compose
version: '3'
services:
client:
#image: ubuntu:18.10
# build : This directive can be used instead of image. Specifies the location of the Dockerfile that will be used to build this container
build: ./
container_name: Chat_client
volumes:
- ./:/code
@armsp
armsp / Steps.md
Last active May 6, 2019 15:49
Steps to run ARM containers on x86
  • Install qemu-arm-static
  • Pull arm32v7/debian:jessie
  • docker run -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static --rm -it arm32v7/debian:jessie --name rpi-test
  • apt-get update
  • apt-get upgrade
  • apt-get install nano
  • apt-get install binutils apt-utils
  • apt-get install build-essential build-essential in turn installs the following- binutils bzip2 cpp cpp-4.9 dpkg-dev fakeroot g++ g++-4.9 gcc gcc-4.9 ifupdown isc-dhcp-client