Skip to content

Instantly share code, notes, and snippets.

@sarim
sarim / README.md
Created December 30, 2022 22:31
mysql podman container as systemd service

mysql podman container as systemd service

compose file initially run by podman-compose to create first container. Might need to run with --initialize first time to init the datadir directory structure. systemd unit file generated by podman generate systemd mysql5 --new. Then edited ExecStartPre.

setting socket path in /etc/mysql/conf.d/mysql.cnf needed for default mysql client command. Custom mysql setting like tuning cache size etc.. can be put into customconf dir.

@sarim
sarim / repairsqlite.sh
Created September 6, 2013 08:14
Sqlite db repair script
#!/bin/bash
DBSTATUS=$(sqlite3 "$1" "PRAGMA integrity_check")
if [ "$DBSTATUS" == "ok" ] ; then
echo DB ALREADY OK
else
echo FIXING CORRUPT DB
TMPDB=$(mktemp -t sarim)
echo ".mode insert
.dump" | sqlite3 "$1" > $TMPDB
[05:55:35] [main/INFO]: Loading Minecraft 1.19 with Fabric Loader 0.14.7
[05:55:35] [ForkJoinPool-1-worker-4/WARN]: Mod fabrishot uses the version ${version} which isn't compatible with Loader's extended semantic version format (Could not parse version number component '${version}'!), SemVer is recommended for reliably evaluating dependencies and prioritizing newer version
[05:55:36] [main/INFO]: Dependencies overridden for borderlessmining, farsight, morechathistory, fabric, dcch, colormatic, ferritecore, debugify
[05:55:36] [main/WARN]: Warnings were found!
- Mod 'Colormatic' (colormatic) 3.1.2+mc.1.19 recommends any version of quilt_loader, which is missing!
- You should install any version of quilt_loader for the optimal experience.
- Mod 'Colormatic' (colormatic) 3.1.2+mc.1.19 recommends any version between 3.0.0 (inclusive) and 4- (exclusive) of mod 'Mod Menu' (modmenu), but only the wrong version is present: 4.0.0!
- You should install any version between 3.0.0 (inclusive) and 4- (exclusive) o
@sarim
sarim / main.php
Created January 3, 2022 21:42
SEGFAULT with symfony cache + http-client in php8.1+symfony6. Works fine in php7.4/symfony5.4
<?php
// composer require symfony/cache
// composer require symfony/http-client
// rm -rf /tmp/symfony-cache/
// php main.php
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\HttpClient\NativeHttpClient;
@sarim
sarim / settings.json
Created June 6, 2021 14:55
vscode settings.json
{
"php-cs-fixer.rules": {
"@Symfony": true,
"@DoctrineAnnotation": true,
"array_indentation": true,
"native_function_invocation": true,
"psr_autoloading": true,
"doctrine_annotation_braces": {"syntax" : "with_braces"},
"method_argument_space": {"ensure_fully_multiline" : true}
},
@sarim
sarim / MonsterMessages.go
Created December 23, 2020 01:01
Adventofcode 2020.19
package main
import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
"time"
@sarim
sarim / kernel-panel-driver-overlay-vga.patch
Created June 2, 2020 16:35
RPI3 kernel-panel-driver-overlay-vga.patch
diff --git a/arch/arm/boot/dts/overlays/vc4-kms-gittu-hdmi-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-gittu-hdmi-overlay.dts
new file mode 100644
index 000000000..9fa4159e2
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/vc4-kms-gittu-hdmi-overlay.dts
@@ -0,0 +1,63 @@
+/*
+ * vc4-kms-v3d-overlay.dts
+ */
+
@sarim
sarim / README.md
Last active February 5, 2020 20:01
Gittu Smart Path Prompt for Bash

##What is it ? Many of us like to see pwd in bash prompt. However if we travel too deep inside directory trees, the path becomes very lengthy and almost eats all the space. So its good to only show last part of the path. That what this script does.

Before:

Before

After:

After

~/ibus-avro➤ aclocal && autoconf && automake --add-missing
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:6: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:6: installing './install-sh'
configure.ac:6: installing './missing'
~/ibus-avro➤ ./configure --prefix=/opt/gittu/avrotest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
{
"explorer.openEditors.visible": 0,
"editor.wordWrap": "on",
"editor.renderIndentGuides": false,
"window.openFilesInNewWindow": "off",
"editor.minimap.enabled": false,
"workbench.sideBar.location": "right",
"window.titleBarStyle": "custom",
"remote.onstartup": true,
"editor.fontSize": 20,