Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Image Transform with TensorFlow.js</title>
<!-- Load TensorFlow.js library -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-tflite.min.js"></script>
</head>
<body>
<h1>Image Transform with TensorFlow.js</h1>
@hughpearse
hughpearse / diff.py
Last active July 17, 2022 20:27
Measure the percentage code change between 2 src directories.
#!/bin/python
import glob
import pathlib
import os
import textdistance
import sys
"""
Author: Hugh Pearse
requirements.txt: textdistance==4.3.0

Build Burrows-Wheeler Alignment (BWA) for Windows

Install the following BWA dependencies in Cygwin:

  • git
  • gcc-core
  • zlib-devel

Compile BWA.

cygwin$ git clone https://github.com/lh3/bwa.git

Installing Samtools Bcftools and HTSlib on Windows

Install and launch MSYS2 build platform.

cmd> winget install --id=msys2.msys2
cmd> c:\msys64\msys2.exe

Using the MSYS2 Pacman package manager, install the gcc build tools and samtools dependencies.

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
class FileIO {
public static void main(String[] args) {
try {
Files.write(Paths.get("output/example.yaml"), new String("Hello, ").getBytes());
Files.write(Paths.get("output/example.yaml"), new String("World!").getBytes(), StandardOpenOption.APPEND);
@hughpearse
hughpearse / kafka.md
Last active September 29, 2021 14:19
Kafka scaling with Siege

Show Code

foo@bar$ git clone https://github.com/hughpearse/kafka-example.git
foo@bar$ cd kafka-example
foo@bar$ vim ./bartender/app.py
foo@bar$ vim ./waiter/app.py
@hughpearse
hughpearse / openshift-operators.md
Created June 5, 2021 10:32
Run Kubernetes Operators in OpenShift 4.x locally

Run OpenShift 4.x locally

This explains how to set up Code Ready Containers (CRC) with kubernetes Operators.

https://cloud.redhat.com/openshift/create/local

Install and launch

foo@bar$ open ~/Downloads/crc-macos-amd64.pkg
foo@bar$ crc setup
@hughpearse
hughpearse / lithops-openwhisk.md
Last active May 27, 2021 23:41
How to deploy Lithops Multicloud with Apache Openwhisk Python 3 to Kubernetes

How to deploy Lithops Multicloud with Apache Openwhisk Python 3 to Kubernetes

This explains how to set up your serverless (FaaS) environment to run Lithops multicloud library. This allows you to avoid vendor lock-in and offboard your serverless code from cloud services.

Reset kubernetes

foo@bar$ export KUBECONFIG=
foo@bar$ minikube stop
foo@bar$ minikube delete --all
@hughpearse
hughpearse / user-mode-linux-alpine-steps.txt
Last active October 25, 2024 22:17
User Mode Linux (UML) Kernel With Alpine Linux OS
How to compile the linux kernel, launch it as a process and boot into Alpine linux
Command + Shift + 5
Host -> Docker GCC -> UML w/ Alpine
# get docker for compiling
foo@host:~$ docker pull gcc
# launch new container
foo@host:~$ docker run --privileged --name gcc -it gcc /bin/bash
import requests
import json
headers = {'Accept': 'application/json', 'User-Agent': 'Hugh'}
url = "https://reddit.com/r/worldnews.json"
r = requests.get(url, headers=headers)
print(r.json()['data'])