Skip to content

Instantly share code, notes, and snippets.

View megatux's full-sized avatar
🏠
Working from home

Cristian Molina megatux

🏠
Working from home
View GitHub Profile

Wayland transition notes for X11 users

Please comment below to contribute. Thanks!

X11 concept Wayland concept Notes
"Window" "Top-level Shell Surface" An entire window, including window decorations
X11 (the specfication) Wayland (the protocols) Neither X11 nor Wayland are binaries that can be installed
Xorg, one universally shared default implementation Multiple competing Wayland compositors Unfortunately there is no universally used single Wayland compositor; apparently every desktop environment does its own, and as a result what works in one may not work in another
export DISPLAY=... export WAYLAND_DISPLAY=... How to know which WAYLAND_DISPLAY one needs to export? The sockets (and their names) should be located in /run/user/*. If WAYLAND_SOCKET is detected, the client will prefer to use the socket provided using that environment variable.
@mudge
mudge / production.rb
Last active November 21, 2023 14:06
How to configure Rails and Rack::Attack to use the real client IP when running behind Cloudflare
Rails.application.configure do
# Add Cloudflare's IPs to the trusted proxy list so they are ignored when
# determining the true client IP.
#
# See https://www.cloudflare.com/ips-v4/ and https://www.cloudflare.com/ips-v6/
config.action_dispatch.trusted_proxies = ActionDispatch::RemoteIp::TRUSTED_PROXIES + %w[
173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
@argami
argami / Caddyfile
Last active February 18, 2024 21:23
Execute HTTPS Local development in 1 Step
https:// {
log
tls internal {
on_demand
}
reverse_proxy :3000
}
@searls
searls / .solargraph.yml
Last active August 2, 2023 09:14 — forked from DRBragg/.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/**/*"
@amirrajan
amirrajan / main.rb
Last active November 20, 2023 07:25
DragonRuby Game Toolkit - Shadows (https://amirrajan.itch.io/shadows) (https://youtu.be/wQknjYk_-dE)
# demo gameplay here: https://youtu.be/wQknjYk_-dE
# this is the core game class. the game is pretty small so this is the only class that was created
class Game
# attr_gtk is a ruby class macro (mixin) that adds the .args, .inputs, .outputs, and .state properties to a class
attr_gtk
# this is the main tick method that will be called every frame the tick method is your standard game loop.
# ie initialize game state, process input, perform simulation calculations, then render
def tick
defaults
@amirrajan
amirrajan / main.rb
Created December 28, 2021 05:08
Spirit of Akina built with DragonRuby Game Toolkit
# Copyright 2021 Scratchwork Development LLC. All rights reserved.
PI = 3.1415926
class Game
attr_gtk
def tick
defaults
render
@didibus
didibus / clojure-right-tool.md
Last active July 10, 2024 04:30
When is Clojure "the right tool for the job"?

My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?

My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.

There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.

That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.

Let's look at some of the dimensions that make a difference and what I think of Clojure for them:

@julianrubisch
julianrubisch / 02-embed-form.erb
Last active May 13, 2021 15:25
StimulusReflex Patterns - 2 Imports
<!-- app/views/embed_imports/_form.html.erb -->
<%= form_with(model: [board, embed_import]) do |form| %>
<%= form.file_field :upload %>
<%= form.submit "Upload Links", class: "inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-lime-600 hover:bg-lime-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-lime-500" %>
<% end %>
@abcdw
abcdw / nix vs guix.org
Last active February 17, 2024 14:21
nix vs guix.org

Nix vs Guix

These are notes to the stream: https://youtu.be/S9V-pcTrdL8

Some notes

  • We are not aware of a lot of GNU software available to us.
  • Seems that Guix more hacker-friendly/explorable.

General comparsion

DescriptionNixGuixComment
@obie
obie / _alert.haml
Created October 15, 2020 03:29
Alerts in Reactive Rails style (with Shoelace web components)
%sl-alert.popup-toast{id: id, type: type, open: false, duration: duration, closable: true}
%sl-icon{slot: "icon", name: icon}
- if title.present?
%strong= title
%br
= text