Skip to content

Instantly share code, notes, and snippets.

View tdegrunt's full-sized avatar

Tom de Grunt tdegrunt

View GitHub Profile
@tdegrunt
tdegrunt / _form.html.erb
Created March 23, 2025 10:09 — forked from lazaronixon/_form.html.erb
Hotwire Event-Driven Update Pattern
<%= form_with model: citizen, class: "card flex flex-col gap", data: { controller: "form" } do |form| %>
<div class="flex flex-col gap mb-2">
<div class="flex flex-col gap-half">
<% countries = Country.order(:name) %>
<%= label_tag :country_id, "Country", class: "text-sm font-medium leading-none" %>
<%= select_tag :country_id, options_from_collection_for_select(countries, :id, :name, citizen.country_id), include_blank: "Select one", class: "input", data: { action: "form#submit", form_submitter_param: "on_country_change" } %>
</div>
<div class="flex flex-col gap-half">
<% states = State.where(country_id: citizen.country_id).order(:name) %>
@tdegrunt
tdegrunt / index.html
Created March 16, 2025 11:20 — forked from fcingolani/index.html
How to render a full PDF using Mozilla's pdf.js
<html>
<body>
<!-- really dirty! this is just a test drive ;) -->
<script type="text/javascript" src="https://raw.github.com/mozilla/pdf.js/gh-pages/build/pdf.js"></script>
<script type="text/javascript">
function renderPDF(url, canvasContainer, options) {
var options = options || { scale: 1 };
@tdegrunt
tdegrunt / restore_table
Last active February 22, 2025 11:08
Bash script to restore specific tables
#!/bin/bash
dump_file='db.dump'
# Where to restore
db_host=''
db_name='dbname'
db_user=''
db_pass=''
tbl_list=("waybillHistory" "waybillOrderLine" "webhook" "xmlLogin" "zipcode")
@tdegrunt
tdegrunt / nerd_fonts.md
Created March 2, 2024 07:39 — forked from davidteren/nerd_fonts.md
Install Nerd Fonts via Homebrew [updated & fixed]
@tdegrunt
tdegrunt / postgres_queries_and_commands.sql
Created January 24, 2024 08:24 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@tdegrunt
tdegrunt / gist:626632aba41fda8fc82af33cc5d940c5
Last active January 15, 2023 12:38
Bluetooth not working on ChimeraOS 38
I'm using a computer (Minisforum HM90) which has a AMD/MediaTek RZ608 bluetooth/wifi chipset, wifi works, but bluetooth doesn't. Initially i got a vcp.c d-bus experimental not enabled error, but that was fixed by adding experimental to /etc/bluetooth/main.conf
After a long read and investigation I found an article mentioning that RZ608 may be buggy and restarting/cycling power and or completely removing the PC from power could resolve the issue. It did.
```
[gamer@chimeraos ~]$ rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
@tdegrunt
tdegrunt / readme.md
Created January 4, 2023 20:20 — forked from Kethen/readme.md
So steam deck recovery image dropped, let's boot it (sorta) (non amd hardware)

Booting the Steam Deck recovery image

https://help.steampowered.com/en/faqs/view/1B71-EDF2-EB6D-2BB3

SteamOS runs a custom grub to cater it's needs for it's A/B partition design. So far the said custom grub does not boot for me on ovmf/intel uefi (maybe it boots on amd? some said they managed to just rufus the image and boot it)

skip to https://gist.github.com/Kethen/698cfa8cf387e131ebd36fbfbfe9272e#gamescope-and-non-amd-gpu if it just boots for you

Upon closer inspection the official bootloader does load some kind of amd firmware before booting the kernel

@tdegrunt
tdegrunt / .solargraph.yml
Created November 14, 2022 13:39 — forked from searls/.solargraph.yml
My config with steps to use solargraph for Rails projects in VS Code (WIP)
---
include:
- ".solargraph_definitions.rb"
- "app/**/*.rb"
- "config/**/*.rb"
- "lib/**/*.rb"
exclude:
- test/**/*
- vendor/**/*
- ".bundle/**/*"
@tdegrunt
tdegrunt / Readme.md
Created July 6, 2022 19:56 — forked from mechamogera/Readme.md
Route53のDynamicDNS設定Rubyスクリプト

使用方法

  • 以下のようにしてスクリプトを取得する。もしくは、downloadして解凍。
 $ git clone git://gist.github.com/3973319.git
  • 実行
  • 自マシンでのIPアドレスを取得してRoute53にhoge.example.com.のAレコードを設定する