Skip to content

Instantly share code, notes, and snippets.

@skle
skle / resize.sh
Last active April 20, 2023 11:14
Resize images according to file size
find . -size +2M -name "*.jpg" | xargs -I {} sudo convert "{}" -resize 2048x2048 -quality 70% -density 72 -verbose "{}"
@skle
skle / convert.js
Created March 21, 2023 12:55
Convert SVG Polygon to CSS clip-path polygon
const sPoints = '4.78,144.93 14.74,124.24 3.33,103.45 0.96,82.88 16.31,62.43 5.59,41.86 0.2,21.29 25.35,1.13 490.9,0.18 490.2,5.86 495.48,27.12 483.43,49.25 476.42,71.15 496,91.72 483.6,113.85 493.97,134.88 499.18,154.58 3.56,155.53'
const iViewboxWidth = 500;
const iViewboxHeight = 155;
const aPoints = sPoints.split(' ').map(function(v)
{
v = v.split(',');
v[0] = Math.round((v[0]/iViewboxWidth) * 10000)/100+'%';
v[1] = Math.round((v[1]/iViewboxHeight) * 10000)/100+'%';
return v.join(' ');
@skle
skle / gist:4a640892f6dae2916b5084e8fac086d5
Created June 27, 2022 11:13
Upgrade MySQL 8 to MariaDB 10 on MacOS
Stop MySQL instance and install MariaDB instance
Next, stop MariaDB instance and start MySQL instance
Export MySQL databases:
mysqlpump --user=root --password --exclude-databases=mysql,sys,information_schema --result-file=backup_full.sql
sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' backup_full.sql
Export MySQL users:
mysqldump -uroot -p --opt --system=users --insert-ignore > users.sql
remove all references to 'root' users from this file
@skle
skle / gist:94188821a0808741adad451e53bf3602
Created February 8, 2021 14:09
Clone HDD with DD on MacOS including progress
sudo dd if=/dev/rdiskX bs=1m | pv -s 64G | sudo dd of=/dev/rdiskY bs=1m
@skle
skle / manifest.json
Created June 14, 2016 16:17
NPO.nl Streams full-screen
{
"name": "NPO Full-screen",
"version": "0.0.1",
"manifest_version": 2,
"description": "Make NPO channels Full-screen",
"browser_action": {
"name": "Manipulate DOM",
"icons": ["icon.png"],
"default_icon": "icon.png"
},
@skle
skle / gist:0d817ea2285269db8867
Created March 9, 2015 14:49
Disable body scroll on iOS, enable scroll on scrollable elements
$(document).on('touchmove',function(e)
{
e.preventDefault();
});
$(document).on('touchstart', '.scroller', function(e)
{
this.startScrollY = e.originalEvent.touches[0].screenY;
this.mayScroll = false;
});