Skip to content

Instantly share code, notes, and snippets.

View gukandrew's full-sized avatar
🇺🇦

gukandrew

🇺🇦
View GitHub Profile
@gukandrew
gukandrew / form.vue
Created January 8, 2025 18:38
Vue 3 Composition API: Vee Validate 4 with zod or yup
<template>
<form @submit="onSubmit">
User Name:
<div>
<input v-model="name" class="border" v-bind="nameAttrs">
<span>{{ errors['user.name'] }}</span>
</div>
User Address:
<div>
@gukandrew
gukandrew / k3s-hello-world-app-served-on-80-port-node.yaml
Created November 12, 2024 17:26
K3s Kubernetes deployment, service, and ingress configuration for hello-world app, serve app in container on 3000 port, exposed on Node 80 port
# kubectl apply -f k3s-hello-world-app-served-on-80-port-node.yaml
# kubectl delete -f k3s-hello-world-app-served-on-80-port-node.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
@gukandrew
gukandrew / custom_shuffle.rb
Last active September 6, 2024 14:55
This Ruby code implements a custom shuffle function using the Fisher-Yates like algorithm
# Custom Shuffle Function in Ruby (Without Using shuffle)
# Description:
# This function takes an integer `n` as input and returns an array of numbers from 1 to `n`
# in a randomized order using the analog of Fisher-Yates algorithm (that runs forward, not backward as Fisher-Yates algorithm).
# The implementation avoids using Ruby's built-in `shuffle` method, ensuring a custom
# randomization approach that produces different sequences with no recognizable pattern.
def random_shuffle(n)
arr = (1..n).to_a
#!/bin/sh
# Script to create databases according to dump filenames if not yet imported
# put `dump.sql` files here near script
# Author: Andrew Guk
for file in /db-dumps/*.sql
do
filename=$(basename $file)
dbname="${filename%%.*}"
@gukandrew
gukandrew / README.md
Created July 3, 2022 18:33 — forked from Informatic/README.md
openlgtv webOS hacking notes

This is just a dump of some interesting undocumented features of webOS (3.8 specifically, on early 2018 4k LG TV) and other development-related tips.

Homebrew app ideas

@gukandrew
gukandrew / youtube_dump_unfollow.md
Created July 2, 2022 18:50
YouTube Download all subscriptions

YouTube Download all subscriptions

** Scripts tested in Firefox only!

Dump subscriptions to file

Log in into your account. Go to https://www.youtube.com/feed/channels and scroll down to load all subscriptions

function download(filename, text) {
    var element = document.createElement('a');
@gukandrew
gukandrew / fuse-ext2_install.command
Created March 12, 2022 18:18
Script to install fuse-ext2 on M1 Mac
#!/bin/zsh
# Script to install fuse-ext2 on M1 Mac
# Install dependencies
#brew install e2fsprogs m4 automake autoconf libtool pkg-config
cd ~/
if [ ! -d ~/fuse-ext2 ]; then
git clone https://github.com/alperakcan/fuse-ext2.git
@gukandrew
gukandrew / node_child_process_spawn.js
Created March 27, 2021 00:06
Spawn child process in node, listen events and log exit code
const spawn = require('child_process').spawn
const proc = spawn(
'pgrep',
[
'-f',
'sh',
]
)
@gukandrew
gukandrew / gw.sh
Created November 23, 2020 10:14
List files of directory(-ies) inside git repository along with their last commit
#!/bin/sh
# USAGE:
# ~/gw.sh [optional: <file1> <file2> ... otherwise current dir will be used]
# complex example
# bash -c "~/gw.sh $(git ls-tree -r --name-only HEAD app/*/web/main.js | tr '\n' ' ')"
#
# SAMPLE OUTPUT:
# ~/gw.sh
# Running on current dir
@gukandrew
gukandrew / list-wp-plugins.sh
Last active November 20, 2020 12:07
List all Wordpress Plugins and their versions
#!/bin/sh
# first grep is all nested plugins, second is for plugins without directory (php file only plugins)
grep -rw -P "(^Version|\sVersion):" wp-content/plugins/*/*.php &&
grep -w -P "(^Version|\sVersion):" wp-content/plugins/*.php