Skip to content

Instantly share code, notes, and snippets.

View szepeviktor's full-sized avatar
🍓
Doing byte-level care

Viktor Szépe szepeviktor

🍓
Doing byte-level care
View GitHub Profile
@szepeviktor
szepeviktor / computer-game-flow.md
Last active July 15, 2023 10:31
How a computer game interacts with the player

Computer game flow

Where to improve you gaming performance.

  1. a local (PC) and a remote (server) computer generates output (audio and video)
  2. output peripherals translate digital signals into physical ones (display, speakers)
  3. sensory organs turn them back to voltage (eyes, ears)
  4. nervous system transmits these signal to the brain
  5. human brain processes these signals and generates responses (reaction time)
  6. nervous system transmits these signal to organs
@szepeviktor
szepeviktor / web-traffic.sh
Created June 25, 2023 15:26
Watch live web traffic without successful requests for static assets #HTTP
tail -f -n0 /var/log/apache2/*.log|grep -vE '\.(ico|css|js|jpg|jpeg|png|svg|gif|ttf|eot|woff|woff2)(\?\S+)? HTTP/(1\.0|1\.1|2\.0)" (200|206)'
# optionally |ccze -m ansi
@szepeviktor
szepeviktor / clone-distribution.sh
Created June 22, 2023 12:36
Clone AWS Cloudfront distribution
# Install AWS CLI and jq
# Copy existing distribution configuration
aws --profile cloudfront cloudfront get-distribution-config --id $DISTRIBUTION_ID --output json \
| jq -r '."DistributionConfig"' >new-distribution.json
# Change CallerReference to a new UUID - https://www.uuidgenerator.net/version4 - apt-get install uuid-runtime; uuidgen
# Change Aliases.Items[] to new domain name
# Search&Replace origin domain name
# Change ViewerCertificate.* to new certificate ARN - https://console.aws.amazon.com/acm/home?region=us-east-1#/certificates/request
@szepeviktor
szepeviktor / youtube-download.sh
Last active November 5, 2023 20:22
Get YouTube download URL-s of video and audio
#!/bin/bash
# Save HTML
wget -O watch.html "https://www.youtube.com/watch?v=VIDEO_ID"
# Extract player data
sed -n -e 's#.*var ytInitialPlayerResponse = \({[^<]\+}\);</script>.*#\1#p' <watch.html >video.json
# For HTML from the browser
#sed -n -e 's#.*var ytInitialPlayerResponse = \({[^<]\+}\);var meta = .*#\1#p' <watch.html >video.json
@szepeviktor
szepeviktor / dual-php-apache.conf
Created May 27, 2023 19:11
Apache configuration for dual PHP
Define SITE_USER linux_user
Define DOCUMENT_ROOT "/home/${SITE_USER}/website/code"
<IfModule mod_proxy_fcgi.c>
DirectoryIndex disabled
DirectoryIndex index.html index.php
ProxyRequests Off
# PHP 5
ProxyPass "/forum" "unix:///run/php5-fpm-${SITE_USER}.sock|fcgi://localhost${DOCUMENT_ROOT}/forum/index.php"
@szepeviktor
szepeviktor / vite-google-tag-manager.js
Last active November 5, 2023 20:19
Google Tag Manager loader for Vite
/**
* Google Tag Manager loader
*
* VITE_GTM_ID="GTM-XXXXX"
* VITE_GTM_DL_NAME=dataLayer
*
* @see https://developers.google.com/tag-platform/tag-manager/web/datalayer
*/
// Skip adding <noscript> element

Announce WooCommerce stubs releases

  • WC Community Slack #core channel
  • Facebook groups
  • Twitter @szepeviktor (mention WC profiles)
  • influencers
  • ask WP core and WC people/managers
@szepeviktor
szepeviktor / Twitter-howto.md
Last active May 21, 2023 17:16
Twitter 101 - How to tweet?

How to bark tweet

Twitter bird with Doge feathers

  • Who am I talking to? (leaders of digital agencies, future non-expert clients)
  • What is the goal of my tweet? How will the reader react? (hire me)
  • When should I tweet?
  1. Check English/English🌟/Deutsch/magyar text
  2. Use emojis
@szepeviktor
szepeviktor / interfood.js
Last active January 30, 2024 22:23
Összpontosítás az Interfoodra https://www.interfood.hu/etlap-es-rendeles/
// Nagy betűk
document.querySelectorAll(".food-etlap-szoveg").forEach(function (text) {text.style.fontSize="16px"; text.style.lineHeight=1.2;});
// Teljes szélességű táblázat
document.querySelectorAll(".food-table.top").forEach(function (element) {element.style.width="100%";});
document.querySelectorAll(".row").forEach(function (element) {element.style.maxWidth="none";});
// A kis adagos menük elrejtése
document.querySelectorAll("[id^='sorszuro_id-'][id$='K']").forEach(function (menuRow) {menuRow.style.display="none";});