Skip to content

Instantly share code, notes, and snippets.

@sryze
sryze / convert-app-icon-ios.sh
Created February 13, 2024 17:35
Convert app icon from a single PNG to different sizes for iOS
# Install ImageMagick before using this script: brew install imagemagick (for the convert command)
sizes="
40x40
60x60
58x58
87x87
80x80
120x120
180x180
@sryze
sryze / bashdo.bat
Last active November 11, 2023 09:33
Quickly run a shell command inside Git Bash from command prompt / PowerShell on Windows (without manually opening a new Git Bash instance)
@echo off
REM Usage: bashdo echo 'hello, world!'
REM Caution: it doesn't work well if there are double quotes in your Bash commands (need to figure out how to escape them).
"%ProgramFiles%\Git\bin\bash.exe" -l -c "%*"
@sryze
sryze / build-deps.md
Last active October 26, 2023 04:43
Installing build dependencies of a Debian package that can be easily removed later

This approach allows you to install a *-build-deps package that can be easily apt autoremoved later when you don't need the dependencies anymore.

  1. Install packaging tools: sudo apt install devscripts equivs
  2. Generate a build-deps package (in this case we use nextcloud-desktop as an example):
    mk-build-deps nextcloud-desktop
    
  3. Install it:

sudo apt install ./nextcloud-desktop-build-deps_x.y.z_amd64.deb

@sryze
sryze / .gitconfig
Last active March 31, 2023 09:20
Git aliases that make it actually usable on the command line
[alias]
re = rebase
st = status
ci = commit
br = branch
co = checkout
cp = cherry-pick
rez = reset --hard @{upstream}
@sryze
sryze / prepare_appicon_images.sh
Last active December 24, 2022 18:28
Script for generating iOS app icons of all sizes from a single SVG image via Inkscape
#!/bin/sh
INKSCAPE=/Applications/Inkscape.app/Contents/MacOS/inkscape
mkdir -p converted
for size in $(echo 512 40 60 58 87 80 120 180 20 40 29 58 76 152 167 1024); do
$INKSCAPE --export-type png --export-filename converted/AppIcon_${size}x${size}.png -w $size AppIconUpdated.svg
done
@sryze
sryze / monitor-check.sh
Last active February 16, 2023 14:43
A shell script for LibreELEC to automatically stop Kodi playback when the HDMI monitor is disconnected / turned off
#!/bin/sh
# Usage:
# 1. Save the script to /storage/monitor-check.sh
# 2. Execute: chmod +x /storage/monitor-check.sh
# 3. Execute: crontab -e and put in this line (runs this script once a minute):
# * * * * * /storage/monitor-check.sh
# 4. Execute: systemctl restart cron
# 5. Make sure that the cron job is working by checking the journal (journalctl -xe -u cron)
@sryze
sryze / set-java-version.sh
Created March 19, 2022 16:50
Script for switching between different versions of Java on Windows (needs Git Bash or similar shell)
#!/bin/sh
java_version=$1
java_home=
IFS=$'\n'
for d in $(find "/c/Program Files/Java" -name "jdk*$java_version*" -type d); do
java_home="$d"
done
@sryze
sryze / .eslintrc.json
Created January 5, 2022 12:11
Base ESLint config
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": false
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2018,
@sryze
sryze / .editorconfig
Created January 5, 2022 12:10
Base EditorConfig config
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@sryze
sryze / .prettierrc
Created January 5, 2022 12:09
Base Prettier config (Prettier sucks though)
{
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"quoteProps": "consistent",
"trailingComma": "none",
"bracketSpacing": false,
"jsxBracketSameLine": true,