Skip to content

Instantly share code, notes, and snippets.

View genothomas's full-sized avatar
🎯
Focusing

Geno Thomas genothomas

🎯
Focusing
View GitHub Profile
@genothomas
genothomas / pyqt5_pdf_viewer.py
Created March 24, 2022 16:30 — forked from glowinthedark/pyqt5_pdf_viewer.py
Python simple PDF viewer using PyQt5 and mozilla's pdf.js
#!/usr/bin/env python3
import sys
from pathlib import Path
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import *
# REQUIREMENTS
@genothomas
genothomas / html2text.py
Created March 24, 2022 16:30 — forked from glowinthedark/html2text.py
HTML to plain text converter using python and lxml
#!/usr/bin/env python3
# Convert HTML markup from a file or stdin to plain text.
#
# Usage:
# html2text.py
#!/usr/bin/env python3
import sys
@genothomas
genothomas / get_gists.py
Created March 24, 2022 16:30 — forked from glowinthedark/get_gists.py
Download all gists for a specific user
#!/usr/bin/env python3
#
# download all gists for a user, pass github user as first arg
# if the gists have already been downloaded before then update them
import json
import os
import re
import requests
@genothomas
genothomas / RsyncBackup.js
Created March 24, 2022 16:30 — forked from glowinthedark/RsyncBackup.js
MacOS RsyncBackup — simplest possible rsync GUI for MacOS
#!/usr/bin/osascript -l JavaScript
// ^^^^ COMMENT/REMOVE THIS SHEBANG IF RUNNING FROM SCRIPT EDITOR!!!!! ^^^^^^^^^^^
// The SHEBANG is only needed if the file is executable and is run from a terminal with `./RsyncBackup.js`
// 1. In MacOS Spotlight type 'Script Editor' and paste the code below
// 2. Click the top-left dropdown which says 'AppleScript' and select 'JavaScript'
// 3. Under menu File pick Export
// 4. In the Export dialog select File Format = Application
// 5. Save the app in /Applications
@genothomas
genothomas / file-to-html.html
Created March 24, 2022 16:29 — forked from glowinthedark/file-to-html.html
Render the contents of a text file on a web page; accept files drag-and-drop
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SRT Reader</title>
<!-- drag-n-drop: https://www.smashingmagazine.com/2018/01/drag-drop-file-uploader-vanilla-js/-->
</head>
<style>
/**br hack from https://stackoverflow.com/a/28310011/191246**/
br {
urlPattern = /^(https?:\/\/)?(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7
@genothomas
genothomas / generate_directory_index_caddystyle.py
Created March 24, 2022 16:27 — forked from glowinthedark/generate_directory_index_caddystyle.py
Generate directory index (recurse subfolders with `-r` or `--recursive`). Use `-h` or `--help` for all options
#!/usr/bin/env python3
# ---
# Copyright 2020 glowinthedark
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
@genothomas
genothomas / http_multithreaded.py
Created March 24, 2022 16:26 — forked from glowinthedark/http_multithreaded.py
Multi-threaded Python3 HTTP Server
#!/usr/bin/env python3
import sys, os, socket
from socketserver import ThreadingMixIn
from http.server import SimpleHTTPRequestHandler, HTTPServer
HOST = socket.gethostname()
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
pass
@genothomas
genothomas / private_fork.md
Created March 10, 2022 22:47
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

#!/bin/bash
sudo mkdir -p /etc/pki/tls/certs
sudo chmod 755 /etc/pki/tls/certs
sudo apt-get install libssl1.0.0 -y
cd /etc/pki/tls/certs
export FQDN=`hostname -f`
echo -------------------
echo FQDN is $FQDN