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)
}