Skip to content

Instantly share code, notes, and snippets.

View sherbondy's full-sized avatar

Ethan Sherbondy sherbondy

View GitHub Profile
@kieraneglin
kieraneglin / example_live_test.exs
Last active November 11, 2024 19:15
Pow sessions with LiveView (including tests)
defmodule MyAppWeb.ExampleLiveTest do
# `LiveviewCase` is a custom test helper - pretty much the same as ConnCase but with
# import Phoenix.LiveViewTest
# import MyApp.Support.AuthHelpers
use MyAppWeb.LiveviewCase, async: false
import MyApp.Factory
alias MyApp.Repo
alias MyAppWeb.ExampleLive
@Pldare
Pldare / aes.cs
Last active August 27, 2026 18:11
vroid web view vrm decrypt
using System;
using System.Security.Cryptography;
using System.IO;
using System.IO.Compression;
namespace Vroid
{
class Vroiddec
{
static void Main(string[] args)
{
@DashBarkHuss
DashBarkHuss / background.js
Created July 20, 2021 22:33
Sample Chrome Extension Message Passing Background to Content Script Manifest V3
try {
// This is the background script for the extension
// A listener for when the user clicks on the extension button
// chrome.action.onClicked.addListener(buttonClicked);
chrome.action.onClicked.addListener(buttonClicked);
// Handle that click
function buttonClicked(tab) {
@mcrumm
mcrumm / app.js
Last active March 4, 2025 13:07
flatpickr + LiveView example
// assets/js/app.js
// ...
import Pickr from "./pickr"
const hooks = {
Pickr
}
// ...
@d12
d12 / realtimedictionary.md
Last active September 1, 2024 06:08
How to use RealtimeDictionary

I had trouble finding information or examples showing how to use RealtimeDictionary, so I put together this doc that details the things I learned as I figured it out.

What is a RealtimeDictionary

RealtimeDictionary isn't a generic C# dictionary that syncs across the network. It specifically maps from uints (unsigned ints, or integers from 0 to ~4 billion) to RealtimeModels. There are other guides which cover RealtimeModels, but they're essentially network-synced structs that can hold whatever data you like.

It's a little complicated if you were just looking to map between two primitive data types, but creating a small RealtimeModel that wraps a single attribute is pretty quick and easy.

Also note that your keys must be unsigned ints. RealtimeDictionary does not support keys of other types.

defmodule MNIST do
import Nx.Defn
@default_defn_compiler {EXLA, run_options: [keep_on_device: true]}
defn init_random_params do
w1 = Nx.random_normal({32, 1, 7, 7}, 0.0, 0.1)
b1 = Nx.random_normal({1, 32, 1, 1}, 0.0, 0.1)
w2 = Nx.random_normal({64, 32, 4, 4}, 0.0, 0.1)
b2 = Nx.random_normal({1, 64, 1, 1}, 0.0, 0.1)
@akihikodaki
akihikodaki / README.en.md
Last active August 5, 2026 22:48
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

NOTE: Time flies, and it's been almost five years(!) since I wrote this. Beaware the text below is now outdated (e.g., now Asahi Linux has graphics acceleration even better than this). The commands listed are up-to-date.

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

@sritchie
sritchie / refman.adoc
Created December 12, 2020 20:58
SICMUtils Reference Manual (ported from the original)

SICMUTILS Reference Manual

Caution
This is a port of the original reference manual for scmutils over to Clojure and the SICMUtils API. The goal here is to host an annotated version of the original refman.txt, highlighting any difference in functionality, behavior and naming so that folks can transition between the systems. The code here assumes that you’re working at a REPL initialized to the the sicmutils.env namespace.
@Tomboyo
Tomboyo / vscode_elixir_debugger_instructions.md
Last active May 16, 2025 09:12
Interactive Elixir Debugging with VSCode and ElixirLS

In this Gist we will configure VSCode for Elixir debugging. Once done, we will be able to debug any function with any arguments by opening the VSCode Run (a.k.a Debug) view, selecting the "mix run" debug configuration, and entering any invocation such as Example.run(:my_args) into a command palette prompt. This will let us step through the code as it executes and use breakpoints like normal.

This Gist expects you have the ElixirLS: Elixir Support and Debugger extension installed. This Gist is based on version 0.6.2.

1. Create a launch configuration

Create a .vscode/launch.json file at the root of your project if one does not exist already. Modify the file to contain inputs and configurations like the following:

{
@april
april / arena-macos-full-screen-fixes.sh
Last active August 25, 2026 19:53
Fixes Magic Arena's broken full screen implementation on macOS
#!/bin/bash
# this forces Arena into full screen mode on startup, set back to 3 to reset
# note that if you go into the Arena "Graphics" preference panel, it will reset all of these
# and you will need to run these commands again
defaults write com.wizards.mtga "Screenmanager Fullscreen mode" -integer 0
defaults write com.wizards.mtga "Screenmanager Resolution Use Native" -integer 0
# you can also replace the long complicated integer bit with any other scaled 16:9
# resolution your system supports.