Skip to content

Instantly share code, notes, and snippets.

@LostKobrakai
LostKobrakai / form_live.ex
Last active December 30, 2024 20:03
Phoenix LiveView form with nested embeds and add/delete buttons
defmodule NestedWeb.FormLive do
use NestedWeb, :live_view
require Logger
defmodule Form do
use Ecto.Schema
import Ecto.Changeset
embedded_schema do
field :name, :string
@pie6k
pie6k / widget.js
Created January 3, 2023 23:37
Scriptable widget showing app revenue
// Copy this code and paste it into Scriptable code editor on your phone
async function loadStats() {
const request = new Request("https://your-endpoint-giving-you-revenue-data.com");
const { todayUSD, todayOrders, revenue30USD, orders30 } = await request.loadJSON();
return { todayUSD, todayOrders, revenue30USD, orders30 };
}
const usdFormatter = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
@h3ssan
h3ssan / JetBrains trial reset.md
Last active December 30, 2024 19:57
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these

@DiceTsuki
DiceTsuki / 00_IN_UE5_CVars_Tweaks_Readme.md
Last active December 30, 2024 19:56
Infinity Nikki: Unreal Engine 5 (UE5) Console Variables (CVars) Tweaks

[Quick Access]

Tested on PC (Windows) Version of Infinity Nikki

Unfortunately, no discussion of Unreal Engine (UE) config files is allowed in Official Infinity Nikki Discord server according to one of the Lead Moderator (modifying game files is against ToS). You have been warned!

Feel free to share and discuss on non-official places!

About

@markcerv
markcerv / gist:906b59ae55316cf851aa0d1fbb2d2cb4
Last active December 30, 2024 19:55
BoxStarter - 2022 - for personal windows 11 dev machine
# This script is setup to use http://boxstarter.org/WebLauncher
# Easiest way is to use IE, and call up this URL:
#
# http://boxstarter.org/package/nr/url?<<<THE ___RAW__ URL OF THIS GIST>>>
#
# or fireup Boxstarter Shell, and then type in:
# Install-BoxstarterPackage -PackageName <<<THE ___RAW__ URL OF THIS GIST>>> -DisableReboots
#
# Want to find more package? visit: https://chocolatey.org/search?q=
@miguelmota
miguelmota / rss_urls.txt
Last active December 30, 2024 19:54
Cryptocurrency news RSS feeds
https://thedefiant.io/feed/
https://www.coindesk.com/arc/outboundfeeds/rss/?outputType=xml
https://cointelegraph.com/rss
https://cryptopotato.com/feed/
https://cryptoslate.com/feed/
https://cryptonews.com/news/feed/
https://smartliquidity.info/feed/
https://finance.yahoo.com/news/rssindex
https://www.cnbc.com/id/10000664/device/rss/rss.html
https://time.com/nextadvisor/feed/
@rameerez
rameerez / kamal-production-server-setup.sh
Last active December 30, 2024 19:54
Set up a Ubuntu server to deploy Kamal 2.x Docker containers to, hardened security and production ready
#!/bin/bash
# Production Docker Host Hardening Script v2
# For Ubuntu Server 24.04 LTS (Noble)
# Suitable for both Kamal deployment and builder hosts
set -euo pipefail
IFS=$'\n\t'
# --- Constants ---
@andelf
andelf / doh.rs
Last active December 30, 2024 19:47
Rust DoH DNS over HTTP Resolver for reqwest
//! A DoH client for the sync crate
//!
//! To be used in ClientBuilder.dns_resolver
use once_cell::sync::Lazy;
use std::{
cell::RefCell,
collections::HashMap,
net::SocketAddr,
time::{Duration, Instant},
@rougier
rougier / dual-header.el
Created December 30, 2024 19:08
Emacs dual header line
;; Dual header line is possible by exploiting the tab-bar line that
;; sits on top of the header line and is generally hidden. For the
;; icon, it has to be precisely cut in top and bottom part and each
;; part is concatenated with either the tab-line or header-line.
(defun dual-header (top bottom)
"This installs a double line header in current buffer using both tab line (TOP) and header line (BOTTOM)."
(set-face-attribute 'tab-line (selected-frame)
@ikupenov
ikupenov / base.ts
Created November 10, 2024 09:58
Drizzle RLS DB with Policies
// schema/entities/base.ts
export const getBaseEntityProps = () => ({
id: uuid("id")
.default(sql`gen_random_uuid()`)
.primaryKey(),
createdAt: timestamp("created_at", { precision: 3 }).notNull().defaultNow(),
});
export const getOwnedBaseEntityProps = () => ({