Skip to content

Instantly share code, notes, and snippets.

@lukas-mertens
lukas-mertens / install_composer.sh
Created December 13, 2025 20:47
Install composer programmatically
#!/bin/sh
# Source: https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
#!/bin/bash
BACKUP_DIR="/opt/backup/mysql-backup"
MYSQL_USR="root"
MYSQL_PWD="your-password"
MYSQL_CMD=/usr/bin/mysql
MYSQL_DMP=/usr/bin/mysqldump
databases=`$MYSQL_CMD --user=$MYSQL_USR -p$MYSQL_PWD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"`
@lukas-mertens
lukas-mertens / svg_to_latex.ps1
Created January 21, 2018 18:22
Powershell-Script to convert all svg-files in the scripts location to LaTeX
$rootDir = $PSScriptRoot
cd $rootDir
foreach($file in Get-ChildItem $rootDir)
{
if($file.Extension.Equals(".svg")) {
$svg_name = $file.Name
$pdf_name = $file.BaseName + ".pdf"
$cmd = "inkscape -D -z --file=$svg_name --export-pdf=$pdf_name --export-latex"
Invoke-Expression $cmd
Rename-Item $file -NewName $($file.BaseName + ".svg_converted")