Skip to content

Instantly share code, notes, and snippets.

View live-wire's full-sized avatar

Dhruv Batheja live-wire

View GitHub Profile
@live-wire
live-wire / DEMO_HISTORY_SERVER_FORK.md
Created May 3, 2023 08:42
History server fork demo

Flink History Server (fork)


Current


  • The History server just needs the job-archive (GCS Bucket) location to start.
flowchart TD
 subgraph HistoryServer
@live-wire
live-wire / 21.py
Created December 21, 2022 07:35
Advent of code 2022 - Day 21 solution - Python3
# time python 21.py
# python 21.py 0.48s user 0.12s system 79% cpu 0.748 total
#
#
import re
from collections import defaultdict
from sympy import solve
INPUT = '21.input'
memonkey = 'humn'
@live-wire
live-wire / 20.py
Created December 20, 2022 13:22
Advent of code 2022 - Day 20 solution
class Node:
def __init__(self, value):
self.value = value
self.next = None
self.prev = None
def __str__(self):
return f'[{str(self.value)}]'
def __repr__(self):
@live-wire
live-wire / nfs.md
Created October 13, 2022 00:03
NFS Server in Ubuntu 22.04.1 LTS and NFS mounting client in macOS-monterey x86

NFS Server


  • Create NFS Server as shown here
    • Just step 1. is enough.
    • For k8s pvc provisioning, follow all steps including csi-driver & storage-class.
  • Now if your server is all set up, we should be able to mount it from any device in the LAN. (Based on the subnet you whitelisted in the step above)
  • MacOS commands:
    • showmount -e <ip-address-of-nfs-server> will show the shared <mount-path>
  • sudo mkdir -p /private/nfs
@live-wire
live-wire / bevy-to-wasm.md
Last active October 4, 2022 17:24
Compiling Bevy game to WASM on x86-intel Mac

Instructions


  • rustup target install wasm32-unknown-unknown

  • cargo install wasm-server-runner

  • cargo install wasm-bindgen-cli

  • Add this to your Cargo.toml

[target.wasm32-unknown-unknown]
@live-wire
live-wire / deployment.yaml
Created May 31, 2022 10:21
sample deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: ephemeral-test-deployment
namespace: test-namespace
spec:
replicas: 600
selector:
matchLabels:
app: ephemeral-test-deployment
@live-wire
live-wire / statefulset.yaml
Created May 31, 2022 10:20
sample statefulset
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ephemeral-test-statefulset
namespace: test-namespace
spec:
replicas: 600
serviceName: ephemeral-test-statefulset
podManagementPolicy: Parallel
selector:
@live-wire
live-wire / spread.py
Last active October 3, 2019 16:01
Get coordinates of patches in an image (2D array)
# Suppose you have a black image with white spots
# This script will give you box coordinates of those spots
#
#
# live-wire.github.io
#
# We will look at the image from the bottom-left and spread outwards
# If a 1 is encountered, the algorithm will try to spread in all directions from that cell.
# See functions possible_moves, possible_moves_exhaustive
@live-wire
live-wire / convert.py
Created September 10, 2019 21:28
JPEG-2000 to JPEG conversion using Python - PIL
# Expects jp2 files in folder jp2-files/
# jpeg files are generated in folder jpeg-files/
import os
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
input_folder = "jp2-files"
output_folder = "jpeg-files"
@live-wire
live-wire / videoflip.py
Created October 5, 2018 01:22
Video Reverse / Flip utility
# Video reverse
import imageio
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--video", help="file path of video to be reversed")
args = parser.parse_args()
def main():