Skip to content

Instantly share code, notes, and snippets.

View SpiffGreen's full-sized avatar
:octocat:
Available

Spiff Jekey-Green SpiffGreen

:octocat:
Available
View GitHub Profile
@SpiffGreen
SpiffGreen / ubuntu-setup.md
Created December 4, 2023 05:49 — forked from BeKnowDo/ubuntu-setup.md
Setting up Ubuntu for my development environment and other utilities

Ubuntu 20.04

Installing gDebi

sudo apt install gdebi-core

Sharing Drives via Samba

  • Install the taskel and samba server packages
    • sudo tasksel install samba-server
    • sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
    • sudo bash -c 'grep -v -E "^#|^;" /etc/samba/smb.conf_backup | grep . > /etc/samba/smb.conf'
  • sudo nano /etc/samba/smb.conf
@SpiffGreen
SpiffGreen / weka.md
Last active August 14, 2023 08:25
Using the Weka Suite for generating models

Weka, a popular suite of machine learning software written in Java, typically exports its generated models in a serialized Java object format. This allows the models to be easily loaded back into a Java environment for further use.

The models can also be exported in PMML (Predictive Model Markup Language) format, which is an XML-based standard for representing predictive models. PMML allows for models to be shared between different statistical and data mining applications.

If you're working with Weka models in a ReactJS environment, you might need to utilize a server-side component that can interpret or convert these models into a format that can be used in the browser, as the native Weka formats are not directly compatible with JavaScript.

Yes, Weka models can be converted to a format that's compatible with JavaScript, but it's not a straightforward process and may require some manual effort. Here's a general approach you can take:

  1. Export the Model to PMML: If possible, export the Weka model to PM
@SpiffGreen
SpiffGreen / nginx.conf
Last active October 11, 2023 10:00
EC2 standard setup with nginx and ssl
worker_processes auto;
events {
worker_connections 1024;
}
http {
# Set the MIME type mappings
include mime.types;
default_type application/octet-stream;
@SpiffGreen
SpiffGreen / nlp_text_summarizer.js
Last active December 12, 2022 13:25
This is a naive text summarization algorithm in javascript
const nlp = require("compromise");
const stopwords = require("./stopwords.json");
const isStopword = (word) => !!stopwords[word.toLowerCase().replace(/[^a-z]/g, '')];
const content = `
This concept of authentication and authorization in expresssjs can be achieved easily using middleware functions. One might ask, "What is a middleware?". Well, a middleware is simply a function. You could think of it as a function that processes requests before the final handler for the matched route does its job and responds to the client who made the request.
A sample use case of a middleware in relation to this topic is having a function(middleware) to check headers, cookies, or body of a request for an authentication token which is verified by the server to authenticate the current user, i.e to know the current user who made the request.
If the server can't authenticate the user, the middleware can simply handle the request and send an authentication error back to the user, without the request getting to the final handler
@SpiffGreen
SpiffGreen / shape_maker.html
Created November 29, 2022 11:40
Sample code to illustrate creating shapes based on land sizes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shape Maker</title>
<style>
* {
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
</head>
<body>
<script>
const urls = {
model:
"https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/model.json",
metadata:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
@SpiffGreen
SpiffGreen / bubble_sort.py
Last active December 15, 2022 06:20
Data Structures & Algorithms - implemented in python
# Bubble sort
def swap(arr, idx1, idx2):
temp = arr[idx1]
arr[idx1] = arr[idx2]
arr[idx2] = temp
def bubbleSort(arr):
for i in range(0, len(arr)):
swapped = False
@SpiffGreen
SpiffGreen / HackathonList.md
Created August 21, 2022 12:26
A list of places to find hackathons
@SpiffGreen
SpiffGreen / login.js
Last active August 18, 2022 22:01
Next auth tutorial
import React from 'react'
import Link from "next/link";
function LoginPage() {
return (
<div className="bg-zinc-300 min-h-screen py-4">
<div className="bg-white rounded-lg p-3 mt-4 max-w-md shadow-sm mx-auto">
<div className="text-center text-2xl my-2 uppercase">Login</div>
<form action="/api/login" method="POST">