Skip to content

Instantly share code, notes, and snippets.

View girorme's full-sized avatar
😀

girorme girorme

😀
View GitHub Profile
@bratsche
bratsche / index.ex
Last active August 23, 2023 16:42
Phoenix LiveView 0.17 table
defmodule ExperimentsWeb.ComposerLive.Index do
use ExperimentsWeb, :live_view
import ExperimentsWeb.ComposerLive.Table
alias Experiments.Composers
alias Experiments.Composers.Composer
@impl true
def mount(_params, _session, socket) do
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active May 29, 2025 14:20
Fix DNS resolution in WSL2

Permanent WSL DNS Fix (WSL 2.2.1+)

If you're encountering ping github.com failing inside WSL with a Temporary failure in name resolution, you're not alone — this has been a long-standing issue, especially when using VPNs or corporate networks.

This issue is now fixed robustly with DNS tunneling, which preserves dynamic DNS behavior and avoids limitations like WSL’s former hard cap of 3 DNS servers in /etc/resolv.conf.

DNS tunneling is enabled by default in WSL version 2.2.1 and later, meaning that if you're still seeing DNS resolution issues, the first and most effective fix is simply to upgrade WSL. Upgrading WSL updates the WSL platform itself, but does not affect your installed Linux distributions, apps, or files.

To upgrade WSL, follow these steps,

@ck3g
ck3g / example.ex
Created February 14, 2019 16:14
How to read from STDIN in Elixir (for HackerRank)
defmodule Solution do
#Enter your code here. Read input from STDIN. Print output to STDOUT
end
array_length = IO.read(:stdio, :line)
array = IO.read(:stdio, :line)
array_length
|> String.trim
|> String.to_integer
@zabirauf
zabirauf / expng.ex
Created July 23, 2015 08:32
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@poliva
poliva / ssf2xj-select-difficulty.xml
Created April 8, 2014 08:07
SSF2XJ mame cheat: Select Difficulty
<cheat desc="Select Difficulty">
<parameter>
<item value="0x00">1/Easiest</item>
<item value="0x01">2/Very Easy</item>
<item value="0x02">3/Easy</item>
<item value="0x03">4/Medium</item>
<item value="0x04">5/Medium Hard</item>
<item value="0x05">6/Hard</item>
<item value="0x06">7/Very Hard</item>
<item value="0x07">8/Hardest</item>
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 31, 2025 06:10
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname