Skip to content

Instantly share code, notes, and snippets.

@kizzx2
kizzx2 / with-env.ps1
Last active December 24, 2024 10:42
Run command with environment variables in PowerShell
$ori = @{}
Try {
$i = 0
# Loading .env files
if(Test-Path $args[0]) {
foreach($line in (Get-Content $args[0])) {
if($line -Match '^\s*$' -Or $line -Match '^#') {
continue
}
@O-I
O-I / weighted_random_sampling.md
Last active December 24, 2024 10:41
[TIx 8] Weighted Random Sampling in Ruby

One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.

Let's take the example of simulating the rolling of a die.

We can represent a die as an array of its faces.

die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
@ebr
ebr / AMD.md
Last active December 24, 2024 10:36
Invoke + ROCm (AMD GPU)

Invoke 5.x+ on AMD

Tested with: AMD Radeon PRO W7900 (Navi33 GPU / RDNA3 architecture). Other GPUs will probably work great with small tweaks, but I don't know what those tweaks might be. Please discover for yourself and report back!

TL;DR

Here's a very basic shell script that does all the things described below. Use it at your own risk. DO understand what it does. Otherwise, read the detailed instructions.

In fact, we really recommend reading the detailed instructions anyway. There's some good info in there.

@fnky
fnky / ANSI.md
Last active December 24, 2024 10:36
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@JuanCarlosAcostaPeraba
JuanCarlosAcostaPeraba / essentials-seo-meta-tags.html
Last active December 24, 2024 10:32
Essential HTML tags for metadata and SEO
<!DOCTYPE html>
<html lang="en">
<head>
<!-- HTML Meta Tags -->
<meta charset="utf-8" /> <!-- encoding -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Scale the content to fit the screen -->
<title>Title</title> <!-- Page title -->
@JuanCarlosAcostaPeraba
JuanCarlosAcostaPeraba / git-commands.md
Created November 29, 2024 01:32
Git Commands with explanation

Git Commands

Command Action
git clone <url> Clone a repository
git add <files names> Add files to staging
git commit -m "<message>" Create commit for staged files
git push -u origin <branch name> Push changes to remote repository
git pull origin <branch name> Download changes from remote repository into the local repository on the current branch
git switch Switch to a branch
@sagivo
sagivo / gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
Last active December 24, 2024 10:30
webRTC stun / turn server list
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@HikmetMelikk
HikmetMelikk / InteractiveWorldMap.tsx
Created December 20, 2024 12:26
World Map with Pin and Hover Effect
"use client";
import { geoCentroid } from "d3-geo";
import dynamic from "next/dynamic";
import { useEffect, useState } from "react";
import { Tooltip } from "react-tooltip";
import "react-tooltip/dist/react-tooltip.css";
const ComposableMap = dynamic(
() => import("react-simple-maps").then((mod) => mod.ComposableMap),
@zhuziyi1989
zhuziyi1989 / URL Schemes.md
Last active December 24, 2024 10:27
常用 URL Schemes 收集。

** 由于此文年事已久,可能某些 URL Schemes 已失效,可在评论区留言指出!(最后更新于 2024.10.28)

关于 URL Scheme 你知道多少?

iOS 系统中

由于苹果的各应用都是在沙盒中,不能够互相之间访问或共享数据。但是苹果还是给出了一个可以在 APP 之间跳转的方法:URL Scheme。简单的说,URL Scheme 就是一个可以让 APP 相互之间可以跳转的协议。每个 APP 的 URL Scheme 都是不一样的,如果存在一样的 URL Scheme,那么系统就会响应先安装那个 APP 的 URL Scheme,因为后安装的 APP 的 URL Scheme 被覆盖掉了,是不能被调用的。

Android 系统中

@KW-M
KW-M / Unreal Engine 5 Installed Build Guide.md
Last active December 24, 2024 10:25
How to build Unreal Engine 5 source into an installed (AKA standalone, AKA rocket, AKA "just like" Unreal Engine from the Epic Games Launcher) editor build
  • This guide assumes you want to build the Unreal Engine 5 (UE5) editor from source in order to get a Windows Unreal Engine 5 Editor to share with a team or studio
  • This was writen with the absolute minimum build requirements for our team to avoid taking more disk space and compile time than needed - please modify to fit your needs.
  • Keep in mind that, as of writing, I have little experience with the Unreal build tools, I'm simply documenting what worked for me.
  • Also see this excellent blog post especially if you are building Unreal Engine 4 (UE4): https://www.edwardbeazer.com/unreal-installed-builds-rocket-buids/

Steps

  1. If you do not have it already, download git bash. https://gitforwindows.org/
  2. Get access to the unreal source repo by following this guide: https://www.unrealengine.com/en-US/ue4-on-github
  3. Install Visual Studio 2019 on the C:\ drive for UE5 (Visual Studio 2017 for ue4)
  • Make sure to install the desktop c++ components, windows sdk (current version should be selected by