Skip to content

Instantly share code, notes, and snippets.

View gukandrew's full-sized avatar
🇺🇦

gukandrew

🇺🇦
View GitHub Profile
@gukandrew
gukandrew / docker-compose.yml
Created June 2, 2020 12:07
MariaDB & phpMyAdmin on Alpine Linux using docker-compose.yml
################################################################################
# docker-compose file to run yobasystems/alpine-mariadb & phpmyadmin/phpmyadmin
#
# run with `docker-compose up -d`
# and connect on host using mysql command: `mysql -h127.0.0.1 -uroot -ppassword`
# or over phpMyAdmin http://localhost:8080/
#
# Author Andrew Guk
################################################################################
@gukandrew
gukandrew / git-wheh.sh
Created August 25, 2020 12:21
Script that shows list of files and last change in git for them, files could be passed as params
#!/bin/sh
# Shows list of files and last change in git for them
# 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' ' ')"
#
# based on: https://stackoverflow.com/a/17361406
@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
@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 / 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 / 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 / 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 / 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

#!/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 / 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