Skip to content

Instantly share code, notes, and snippets.

View TimaGribanov's full-sized avatar
πŸ‡ΊπŸ‡¦

Tima Gribanov TimaGribanov

πŸ‡ΊπŸ‡¦
View GitHub Profile
@TimaGribanov
TimaGribanov / wp_insert_excerpt.sql
Last active May 6, 2025 14:08
Add a paragraph before 'read more' as an excerpt to a WordPress post
/*Select the needed part (excluding <p> tags and <!-- wp:paragraph --> line*/
SELECT
REPLACE(REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(post_content, '\n', 2), '\n', -1), '<p>', ''), '</p>', '') as excerpt
FROM
wp_posts wp
WHERE
ID = 1771;
/*Insert that part as an excerpt for a certain post*/
UPDATE
// EN_EXT (English Extended Layout).
// This is a modified English US intl., with dead keys keyboard
// Timofey Gribanov <[email protected]>
// Last changes 2022/01/18
//
// β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”²β”β”β”β”β”β”β”β”β”β”β”β”“
// β”‚ ~ β”‚ ! β”‚ @ β”‚ # β”‚ $ β”‚ % β”‚ ^ β”‚ & β”‚ * β”‚ ( β€œ β”‚ ) β€œ β”‚ _ β”‚ + ┃ ⌫ ┃
// β”‚ ` β”‚ 1 Β‘ β”‚ 2 β”‚ 3 β”‚ 4 Β£ β”‚ 5 € β”‚ 6 β—ŒΜŒ β”‚ 7 β”‚ 8 β”‚ 9 β€˜ β”‚ 0 ’ β”‚ - β€” β”‚ = – ┃Backspace ┃
// ┒━━━━━┷━━━┱─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┺━━━┳━━━━━━━┫
// ┃ Tab ┃ Q β”‚ W β”‚ E β”‚ R β”‚ T β”‚ Y β”‚ U β”‚ I β”‚ O β”‚ P β”‚ { β”‚ } ┃ Enter ┃
@TimaGribanov
TimaGribanov / hex_to_binary.sh
Created March 12, 2021 08:39
Little bash script to convert HEX string into binary string
#!/bin/bash
INPUTVAR="$1"
INPUTVARSIZE=${#INPUTVAR}
LOOPCOUNTER=0
while [ $LOOPCOUNTER -lt $INPUTVARSIZE ]
do
HEXVAR="${INPUTVAR:$LOOPCOUNTER:1}"
@TimaGribanov
TimaGribanov / decimal2ip.sh
Created October 24, 2019 13:16
Converting IPs
#!/bin/bash
#Converting decimal to binary
##Source: https://stackoverflow.com/questions/55239476/awk-convert-decimal-to-binary
gawk '
function d2b(d, b) {
while(d) {
b=d%2b
d=int(d/2)
}