Skip to content

Instantly share code, notes, and snippets.

View gukandrew's full-sized avatar
🇺🇦

gukandrew

🇺🇦
View GitHub Profile
#!/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
@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 / 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 / magento_quote_selected_custom_option_value.php
Created March 3, 2020 16:20
Get selected values of custom options from Magento2 Quote
<?php
$quoteId = 1;
$ObjectManager = \Magento\Framework\App\ObjectManager::getInstance();
$quoteCollectionFactory = $ObjectManager->create('\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory');
$QuoteRepository = $ObjectManager->create('\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory');
$quote = $quoteCollectionFactory->create()
->addFieldToFilter('quote_id', $quoteId)
->getFirstItem();