Skip to content

Instantly share code, notes, and snippets.

View CognitiveDave's full-sized avatar
⚔️
Fighting Python3, NodeJs, MongoDB aggregation Pipeline, CSS, HTML, Linux

David Moore CognitiveDave

⚔️
Fighting Python3, NodeJs, MongoDB aggregation Pipeline, CSS, HTML, Linux
View GitHub Profile
@CognitiveDave
CognitiveDave / remoteShutdown.sh
Created December 6, 2020 09:31
Shutting down nodes in a Cluster via SSH
#!/bin/sh
for x in 4 3 2 1 0
do
echo "killing node$x"
ssh pc$x 'sudo init 0'
done
# use Tesseract to OCR the image
text = pytesseract.image_to_string(image)
results = []
#print(text)
tdData = text.replace(',','').replace('@','0').replace('‘','').replace(')','').split('\n')
for data in tdData[3:]:
#print(data)
rec = {}
elems = data.split(' ')
rec['county'] = elems[0]
from myYoloC import myYolo
from datetime import datetime
import pickle
directoryBase = "/home/david/Documents/projects/yolo-object-detection/images/"
directoryList = ['2021-01-22/',
'2021-01-23/',
'2021-01-24/',
'2021-01-25/',
'2021-01-26/',
@CognitiveDave
CognitiveDave / web.py
Created February 28, 2021 10:30
A python flask backend
from flask import Flask, render_template, g, jsonify, request, redirect, url_for, session, flash
from gensim import corpora
import os
app = Flask(__name__,
static_folder = "./dist/static",
template_folder = "./dist")
@app.route("/home")
def hello():
@CognitiveDave
CognitiveDave / vue.config.js
Created February 28, 2021 10:57
vue.js configuration for assets and static folder build
module.exports = {
outputDir: "./dist",
// relative to outputDir
assetsDir: "static"
};
@app.route('/keywords', methods=['GET','POST'])
def keywords():
response_object = {'keywords': ['birds','scatt']}
post_data = request.get_json()
if post_data['text'] != None:
keywords = LangServices.keywords(post_data['text'])
if len(keywords) > 0:
response_object = {'keywords' : keywords['ranked phrases']}
return jsonify(response_object)
@CognitiveDave
CognitiveDave / template.vue
Created April 6, 2021 18:54
UI_Change_Semantic
<template>
<div>
<div class="container">
<h1>{{ msg }}</h1>
<b-form @submit="getKeywords" @reset="onReset" v-if="show">
<b-form-group
id="input-group-1"
label="Job description:"
label-for="input-1"
description="Copy and Paste in the text you want to work with."
@CognitiveDave
CognitiveDave / vueScript.vue
Created April 6, 2021 18:55
semanticScript for vue template
<script>
import axios from 'axios'
export default {
name: 'text',
props: {
msg: String
},
data() {
return {
@CognitiveDave
CognitiveDave / fromfile.py
Created January 29, 2022 14:19
get data from file
def get_data_from_given_path(file_name: pycamunda.variable.Variable) -> typing.Dict[str, str]:
textback= p.from_file(file_name.value)
text = textback["content"].strip()
print(file_name)
if len(text) < 4000:
return {'text': text}
else:
return {'text': text[0:3800]}
@CognitiveDave
CognitiveDave / example.py
Created January 29, 2022 15:49
creating instances in a workflow
filesd = ["/home/david/Downloads/test.pdf",
"/home/david/Downloads/test2.pdf",
"/home/david/Downloads/test3.pdf",
"/home/david/Downloads/test4.pdf"
]
url = 'http://localhost:8080/engine-rest'
worker_id = '1'
for filei in filesd: