Skip to content

Instantly share code, notes, and snippets.

@berarma
berarma / gist:f7a247dcdc385bbda5cb82be9fabaf56
Created February 23, 2025 10:12
Debug Godot over Wine on Debian
Install packages `wine, `gdb-mingw-w64-target` and `gdb-mingw-w64`.
Start gdb server:
`wine /usr/share/win64/gdbserver.exe localhost:1111 ~/godot/bin/godot.windows.editor.x86_64.exe --headless test_scene.tscn`
Start gdb:
`x86_64-w64-mingw32-gdb ~/godot/bin/godot.windows.editor.x86_64.exe`
Connect gdb to gdb server:
`target remote localhost:1111`
Allow moving left when left + right are pressed:
https://github.com/simon-frankau/head-over-heels/blob/f4f318f9dea624b1760064a1da76b20b125a519d/src/directions.asm#L23
POKE 35998,6
Don't stutter when changing keys pressed:
https://github.com/simon-frankau/head-over-heels/blob/f4f318f9dea624b1760064a1da76b20b125a519d/src/character.asm#L579
POKE 42913,24
@berarma
berarma / FirefoxHWAccel.md
Last active August 2, 2022 21:33
Settings for full video hardware acceleration for Firefox 103 on Debian 11 with Ryzen 5 5500U

Enable Hardware Video Acceleration with VA-API on Firefox and AMD GPU

Requirements

Tested with Firefox 103.1.

Use command vainfo to check supported codecs.

Use radeontop to check for AMD GPU usage.

Optimize JPEG/PNG images for the web using ImageMagick

convert -filter Triangle -define filter:support=2 -thumbnail %target-width% -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality %jpeg-quality% -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB original-image.jpg optimized-image.jpg

%target-width%: Width of the final image in pixels. %jpeg-quality%: JPEG quality setting (0-100).

@berarma
berarma / RefreshAssociationsTrait.php
Last active June 29, 2022 12:15
RefreshAssociationTrait for CakePHP3
<?php
namespace App\Model\Table;
use Cake\ORM\Entity;
trait RefreshAssociationsTrait
{
public function refreshAssociations(Entity $entity, array $associations = null)
{
if ($associations === null) {
@berarma
berarma / build_neovim_in_debian.markdown
Last active March 6, 2019 14:26
Neovim build instructions for Debian

This is what I had to do to build and install Neovim 0.3.4 with Python2 and Python3 support on Debian Stretch.

$ sudo apt install cmake libuv1-dev libmsgpack-dev libluajit-5.1-dev libunibilium-dev libtermkey-dev libvterm-dev libjemalloc-dev luajit lua-mpack gperf python3-pip

$ sudo pip2 install --upgrade pynvim

$ sudo pip3 install --upgrade pynvim

$ git clone neovim/neovim

@berarma
berarma / AssetsHelper.php
Created December 26, 2013 11:50
CakePHP helper class that extends AssetCompress.AssetCompress to inline CSS and JS.
<?php
App::uses('AssetCompress.AssetCompress', 'View/Helper');
class AssetsHelper extends AssetCompressHelper {
public function inlineCss($file, $options = array()) {
if (Configure::read('debug') > 0) {
return $this->css($file, $options);
}
$file = $this->_addExt($file, '.css');