Nixpacks build NX

NIXPACKS_NX_APP_NAME=backend zsh -c 'nixpacks build . --name stonkerino-backend --start-cmd "node dist/apps/backend/main.js" --build-cmd "pnpm exec nx run backend:build --configuration=production"'

yt-dlp

# single video:
yt-dlp -c -i --restrict-filenames --socket-timeout 120 --retries 9999 -S res,ext:mp4:m4a --recode mp4 --embed-metadata -r 2000k 'url'

# playlist
yt-dlp -c -i --restrict-filenames --socket-timeout 120 --retries 9999 -S res,ext:mp4:m4a --recode mp4 -o '%(playlist_uploader)s-%(playlist_title)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s' --embed-metadata -r 2000k --download-archive 'my-yt-dlp-archive.txt' 'url'


# without re-enconding into mp4:
# single
yt-dlp -c -i --restrict-filenames --socket-timeout 120 --retries 9999 -S res,ext:mp4:m4a --embed-metadata -r 2000k 'url'
# playlist
yt-dlp -c -i --restrict-filenames --socket-timeout 120 --retries 9999 -S res,ext:mp4:m4a -o '%(playlist_uploader)s-%(playlist_title)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s' --embed-metadata -r 2000k  'url'

WP – activate plugin directly from database

$data = <<<DATA
a:38:{i:0;s:29:"gravityforms/gravityforms.php";i:1;s:27:"acf-address/acf-address.php";i:2;s:45:"acf-fewbricks-hidden/acf-fewbricks-hidden.php";i:3;s:29:"acf-field-video/acf-video.php";i:4;s:39:"acf-gravity-forms/acf-gravity_forms.php";i:5;s:37:"acf-smart-button/acf-smart-button.php";i:6;s:57:"advanced-custom-fields-nav-menu-field/fz-acf-nav-menu.php";i:7;s:34:"advanced-custom-fields-pro/acf.php";i:8;s:53:"ajax-load-more-preloaded/ajax-load-more-preloaded.php";i:9;s:65:"ajax-load-more-theme-repeaters/ajax-load-more-theme-repeaters.php";i:10;s:33:"ajax-load-more/ajax-load-more.php";i:11;s:47:"better-search-replace/better-search-replace.php";i:12;s:43:"broken-link-checker/broken-link-checker.php";i:13;s:45:"classic-editor-addon/classic-editor-addon.php";i:14;s:33:"classic-editor/classic-editor.php";i:15;s:33:"disable-emojis/disable-emojis.php";i:16;s:32:"duplicate-page/duplicatepage.php";i:17;s:45:"enable-media-replace/enable-media-replace.php";i:18;s:33:"events-manager/events-manager.php";i:19;s:23:"fewbricks/fewbricks.php";i:20;s:43:"google-analytics-dashboard-for-wp/gadwp.php";i:21;s:77:"gravity-forms-wcag-20-form-fields/gravity_forms_wcag20_form_fields_plugin.php";i:22;s:57:"gravityforms-postman-addon/gravityforms-postman-addon.php";i:23;s:29:"gravityformssurvey/survey.php";i:24;s:23:"page-list/page-list.php";i:25;s:29:"pdf-embedder/pdf_embedder.php";i:26;s:15:"plate/plate.php";i:27;s:67:"post-type-select-for-advanced-custom-fields/acf-posttype-select.php";i:28;s:27:"redirection/redirection.php";i:29;s:47:"regenerate-thumbnails/regenerate-thumbnails.php";i:30;s:23:"totalpoll/totalpoll.php";i:31;s:31:"vision6-forms/vision6-forms.php";i:32;s:23:"wordfence/wordfence.php";i:33;s:40:"wordpress-seo-premium/wp-seo-premium.php";i:34;s:24:"wordpress-seo/wp-seo.php";i:35;s:25:"wp-better-emails/wpbe.php";i:36;s:37:"wp-h5bp-htaccess/wp-h5bp-htaccess.php";i:37;s:39:"wp-stage-switcher/wp-stage-switcher.php";}
DATA;

$data = unserialize($data);

$data[] = 'timber-library/timber.php';

echo serialize($data);

wp-cli – search replace URL

wp search-replace --skip-columns=guid --skip-tables=wp_users,wp_usermeta 'original-domain.com' 'new-domain.com'

# or test/count first with --dry-run
wp search-replace --skip-columns=guid --skip-tables=wp_users,wp_usermeta 'original-domain.com' 'new-domain.com' --dry-run

WP UpdraftPlus – disable plugin on local

# wp-config.php
define( 'WP_ENVIRONMENT_TYPE', 'staging' );

# in a mu-plugin
add_filter(
	'updraftplus_boot_backup',
	function( $go_ahead ) {
		return ( 'local' === wp_get_environment_type() );
	}
);

wp – theme test all WYSWYG editor tags

<p><strong>Headings</strong></p>
<h1>Header one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<h2>Blockquotes</h2>
<p>Single line blockquote:</p>
<blockquote>
<p>Stay hungry. Stay foolish.</p>
</blockquote>
<p>Multi line blockquote with a cite reference:</p>
<blockquote cite="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote">
<p>The <strong>HTML <code><blockquote></code> Element</strong> (or <em>HTML Block Quotation Element</em>) indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation (see <a href="https://developer.mozilla.org/en-US/docs/HTML/Element/blockquote#Notes">Notes</a> for how to change it). A URL for the source of the quotation may be given using the <strong>cite</strong> attribute, while a text representation of the source can be given using the <a title="The HTML Citation Element <cite> represents a reference to a creative work. It must include the title of a work or a URL reference, which may be in an abbreviated form according to the conventions used for the addition of citation metadata." href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite"><code><cite></code></a> element.</p>
</blockquote>
<p><cite>multiple contributors</cite> - MDN HTML element reference - blockquote</p>
<h2>Tables</h2>
<table>
<thead>
<tr>
<th>Employee</th>
<th>Salary</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<th><a href="http://example.org/">John Doe</a></th>
<td>$1</td>
<td>Because that's all Steve Jobs needed for a salary.</td>
</tr>
<tr>
<th><a href="http://example.org/">Jane Doe</a></th>
<td>$100K</td>
<td>For all the blogging she does.</td>
</tr>
<tr>
<th><a href="http://example.org/">Fred Bloggs</a></th>
<td>$100M</td>
<td>Pictures are worth a thousand words, right? So Jane x 1,000.</td>
</tr>
<tr>
<th><a href="http://example.org/">Jane Bloggs</a></th>
<td>$100B</td>
<td>With hair like that?! Enough said...</td>
</tr>
</tbody>
</table>
<h2>Definition Lists</h2>
<dl>
<dt>Definition List Title</dt>
<dd>Definition list division.</dd>
<dt>Startup</dt>
<dd>A startup company or startup is a company or temporary organization designed to search for a repeatable and scalable business model.</dd>
<dt>#dowork</dt>
<dd>Coined by Rob Dyrdek and his personal body guard Christopher "Big Black" Boykins, "Do Work" works as a self motivator, to motivating your friends.</dd>
<dt>Do It Live</dt>
<dd>I'll let Bill O'Reilly will <a title="We'll Do It Live" href="https://www.youtube.com/watch?v=O_HyZ5aW76c">explain</a> this one.</dd>
</dl>
<h2>Unordered Lists (Nested)</h2>
<ul>
<li>List item one
<ul>
<li>List item one
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
<h2>Ordered List (Nested)</h2>
<ol start="8">
<li>List item one -start at 8
<ol>
<li>List item one
<ol reversed="reversed">
<li>List item one -reversed attribute</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
<h2>HTML Tags</h2>
<p>These supported tags come from the WordPress.com code <a title="Code" href="https://en.support.wordpress.com/code/">FAQ</a>.</p>
<p><strong>Address Tag</strong></p>
<address>1 Infinite Loop<br />Cupertino, CA 95014<br />United States</address>
<p><strong>Anchor Tag (aka. Link)</strong></p>
<p>This is an example of a <a title="WordPress Foundation" href="https://wordpressfoundation.org/">link</a>.</p>
<p><strong>Abbreviation Tag</strong></p>
<p>The abbreviation <abbr title="Seriously">srsly</abbr> stands for "seriously".</p>
<p><strong>Acronym Tag (<em>deprecated in HTML5</em>)</strong></p>
<p>The acronym <acronym title="For The Win">ftw</acronym> stands for "for the win".</p>
<p><strong>Big Tag</strong> (<em>deprecated in HTML5</em>)</p>
<p>These tests are a <big>big</big> deal, but this tag is no longer supported in HTML5.</p>
<p><strong>Cite Tag</strong></p>
<p>"Code is poetry." --<cite>Automattic</cite></p>
<p><strong>Code Tag</strong></p>
<p>This tag styles blocks of code.<br /><code>.post-title {<br />
	margin: 0 0 5px;<br />
	font-weight: bold;<br />
	font-size: 38px;<br />
	line-height: 1.2;<br />
	and here's a line of some really, really, really, really long text, just to see how it is handled and to find out how it overflows;<br />
}</code><br />You will learn later on in these tests that <code>word-wrap: break-word;</code> will be your best friend.</p>
<p><strong>Delete Tag</strong></p>
<p>This tag will let you <del cite="deleted it">strike out text</del>, but this tag is <em>recommended</em> supported in HTML5 (use the <code><s></code> instead).</p>
<p><strong>Emphasize Tag</strong></p>
<p>The emphasize tag should <em>italicize</em> <i>text</i>.</p>
<p><strong>Horizontal Rule Tag</strong></p>
<hr />
<p>This sentence is following a <code><hr /></code> tag.</p>
<p><strong>Insert Tag</strong></p>
<p>This tag should denote <ins cite="inserted it">inserted</ins> text.</p>
<p><strong>Keyboard Tag</strong></p>
<p>This scarcely known tag emulates <kbd>keyboard text</kbd>, which is usually styled like the <code><code></code> tag.</p>
<p><strong>Preformatted Tag</strong></p>
<p>This tag is for preserving whitespace as typed, such as in poetry or ASCII art.</p>
<h2>The Road Not Taken</h2>
<pre><cite>Robert Frost</cite>


  Two roads diverged in a yellow wood,
  And sorry I could not travel both          (\_/)
  And be one traveler, long I stood         (='.'=)
  And looked down one as far as I could     (")_(")
  To where it bent in the undergrowth;

  Then took the other, as just as fair,
  And having perhaps the better claim,          |\_/|
  Because it was grassy and wanted wear;       / @ @ \
  Though as for that the passing there        ( > º < )
  Had worn them really about the same,         `>>x<<´
                                               /  O  \
  And both that morning equally lay
  In leaves no step had trodden black.
  Oh, I kept the first for another day!
  Yet knowing how way leads on to way,
  I doubted if I should ever come back.

  I shall be telling this with a sigh
  Somewhere ages and ages hence:
  Two roads diverged in a wood, and I—
  I took the one less traveled by,
  And that has made all the difference.


  and here's a line of some really, really, really, really long text, just to see how it is handled and to find out how it overflows;
</pre>
<p><strong>Quote Tag</strong> for short, inline quotes</p>
<p><q>Developers, developers, developers...</q> --Steve Ballmer</p>
<p><strong>Strike Tag</strong> (<em>deprecated in HTML5</em>) and <strong>S Tag</strong></p>
<p>This tag shows <span style="text-decoration: line-through;">strike-through</span> <s>text</s>.</p>
<p><strong>Small Tag</strong></p>
<p>This tag shows <small>smaller<small> text.</small></small></p>
<p><strong>Strong Tag</strong></p>
<p>This tag shows <strong>bold<strong> text.</strong></strong></p>
<p><strong>Subscript Tag</strong></p>
<p>Getting our science styling on with H<sub>2</sub>O, which should push the "2" down.</p>
<p><strong>Superscript Tag</strong></p>
<p>Still sticking with science and Albert Einstein's E = MC<sup>2</sup>, which should lift the 2 up.</p>
<p><strong>Teletype Tag </strong>(<em>obsolete in HTML5</em>)</p>
<p>This rarely used tag emulates <tt>teletype text</tt>, which is usually styled like the <code><code></code> tag.</p>
<p><strong>Underline Tag</strong> <em>deprecated in HTML 4, re-introduced in HTML5 with other semantics</em></p>
<p>This tag shows <u>underlined text</u>.</p>
<p><strong>Variable Tag</strong></p>
<p>This allows you to denote <var>variables</var>.</p>

WHM/cPanel – list all sites

var sites = '';
document.querySelectorAll("#listaccts > tbody > tr > td:nth-child(2) > a").forEach(function(el) {
    sites += el.innerText.trim() + "\n";
});
console.log(sites);

youtube-dl – download videos from a list

youtube-dl --download-archive done.txt -a download.txt -f 135+140 --restrict-filenames -r 1000k -o '%(uploader)s/%(uploader)s-%(upload_date)s-%(title)s.%(ext)s'

Samsung UR55 Color settings

Issue: yellowish tint on default settings

Correct settings:

Color Tone: Custom
Gamma: Mode 1
Red: 44
Green: 49
Blue: 64

Samsung Magic Bright: Custom
Brightness: 100
Contrast: 80
Sharpness: 52
Samsung Upscale: off
HDMI Black level: Normal
Eye Saver Mode: off
Game mode: off
Response Time: Faster
Screen Ratio: Wide

MAC:

Correct settings:

Color Tone: Custom
Gamma: Mode 3
Red: 42
Green: 47
Blue: 64

Samsung Magic Bright: Custom
Brightness: 75
Contrast: 45
Sharpness: 32
Samsung Upscale: off
HDMI Black level: Normal
Eye Saver Mode: off
Game mode: off
Response Time: Faster
Screen Ratio: Wide

WampServer – SSL per vhost

<VirtualHost myproject.local.test:443>
    DocumentRoot "D:/arvil/Projects/vhosted/myproject.local.test/public_html"
    ServerName myproject.local.test:443
    ServerAdmin [email protected]
    
     <Directory "D:/arvil/Projects/vhosted/myproject.local.test/public_html">
        AllowOverride All
        Require local
    </Directory>
          
 
    SSLEngine on
 
    SSLCertificateFile "D:/arvil/Projects/vhosted/myproject.local.test/myproject.local.test.cert"
    SSLCertificateKeyFile "D:/arvil/Projects/vhosted/myproject.local.test/myproject.local.test.key"
 
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "D:/Applications/wamp64/bin/apache/apache2.4.37/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch "MSIE [2-5]" \
             nokeepalive ssl-unclean-shutdown \
             downgrade-1.0 force-response-1.0
		
</VirtualHost>

wp-cli as bash alias

#on ~/.bash_profile, add:
alias wp='php -d "disable_functions=" /<path_to>/wp-cli.phar'

Acquia Dev Desktop – use Drush 7 for Drupal 7 sites

echo $DEVDESKTOP_DRUPAL_SETTINGS_DIR
// returns empty string
//
  
export DEVDESKTOP_DRUPAL_SETTINGS_DIR=$HOME/.acquia/DevDesktop/DrupalSettings
echo $DEVDESKTOP_DRUPAL_SETTINGS_DIR
// returns:
//  ~/.acquia/DevDesktop/DrupalSettings
  
vendor/drush/drush/drush --verbose --debug info
// returns
// Drush bootstrap phase : bootstrap_drupal_database() [0.27 sec, 5.39 MB]                                                                                                [bootstrap]
// Successfully connected to the Drupal database. [0.29 sec, 5.75 MB]                                                                                                     [bootstrap]

WordPress – add a new admin user directly using database

# Replace the following:
# <DATABASE NAME>
# <WP TABLE PREFIX> = "wp_"

INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>users` (`user_login`, `user_pass`, `user_email`, `user_registered`) VALUES ('new_admin', MD5('123456'), '[email protected]', NOW());

# Get the user id of the use
# Replace <ADDED USER ID>
INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '<ADDED USER ID>', '<WP TABLE PREFIX>capabilities', 'a:1:{s:13:"administrator";b:1;}');

INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '<ADDED USER ID>', '<WP TABLE PREFIX>user_level', '10');