Skip to content

Instantly share code, notes, and snippets.

@Huud
Huud / Generate Normal Map From Height Map.py
Last active May 7, 2024 17:55
Generate Normal Map From Height Map
# A fast - numpy based - CPU functions that take a height map and generate a normal map from it
import numpy as np
import matplotlib.image as mpimg
# a function that takes a vector - three numbers - and normalize it, i.e make it's length = 1
def normalizeRGB(vec):
length = np.sqrt(vec[:,:,0]**2 + vec[:,:,1]**2 + vec[:,:,2]**2)
vec[:,:,0] = vec[:,:,0] / length
vec[:,:,1] = vec[:,:,1] / length
@JBlond
JBlond / bash-colors.md
Last active May 7, 2024 17:55 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@td-shi
td-shi / ulid.sh
Last active May 7, 2024 17:55
ULID on shell script. Universally Unique Lexicographically Sortable Identifier. [ULID](https://github.com/ulid/spec)
#!/bin/sh
# -*- coding:utf-8 posix -*-
# === Initialize shell environment =============================================
#set -u # Just stop undefined values.
#set -e # Just stop error.
#set -x # Debug running command.
umask 0022
export LC_ALL=C
export LANG=C
@KingKrouch
KingKrouch / MyProblemsWithUnrealEngine.md
Last active May 7, 2024 17:55
My problems with Unreal Engine and how developer and PC oriented features have been neglected over the years.

Here's my biggest issues with Unreal Engine at the moment, and subsequently, games (especially UE games on PC) that use it:

  • For starters, the default settings for Unreal projects are hilariously bad, some of which are exposed deep in the editor settings, the others requiring config tweaks on the developer's side.
    For example, every Unreal Engine project ships with Vert- FOV scaling by default (As a massive middle finger to ultrawide users, despite how trivial it is to fix), and also has mouse smoothing and sensitivity that scales based on the FOV enabled (resulting in mouse input feeling wonky, this was actually one big complaint people had with Atomic Heart's release). The former is a problem because it causes the FOV to zoom in the wider the resolution aspect ratio *(While keeping the intended horizontal space by ad
@serg987
serg987 / docker-compose.yml
Last active May 7, 2024 17:52
adguardhome docker-compose with macvlan
# short link: www.shorturl.at/wzM69
version: "3"
networks:
adguard-macvlan:
name: adguard-macvlan
driver: macvlan
driver_opts:
parent: eno1
ipam:
@m-jovanovic
m-jovanovic / .editorconfig
Created June 7, 2023 12:17
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
@cyphunk
cyphunk / activeportal.py
Created December 5, 2022 12:57
activeportal notes pulled from surrogatewitch performance project. use in combined with wifi_hostpost.sh from pitheatre
#!/usr/bin/env python3
# opens a HTTP and HTTPS server
port = 8083
portssl = 8443
# NGINX Setup in sites-enabled:
"""
test -e /etc/nginx/sites-available/captiveportal_http \
|| cat <<EOF > /etc/nginx/sites-available/captiveportal_http
server {
@YPermitin
YPermitin / VMWareWorkstation-Error-KernelModuleInstall.md
Last active May 7, 2024 17:49
Решение проблемы с установкой модулей VMWare Workstation на Ubuntu 22.04

Решение проблемы с установкой модулей VMWare Workstation на Ubuntu 22.04

Описание решения ошибок при установке модулей VMWare Workstation на Ubuntu 22.04 после обновления ядра или при начальной установке.

Описание проблемы

При попытке установки модулей VMWare Workstation могут возникнуть ошибки вида:

Unable to install all modules
@eshelman
eshelman / latency.txt
Last active May 7, 2024 17:49 — forked from jboner/latency.txt
HPC-oriented Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference/hit 1.5 ns 4 cycles
Floating-point add/mult/FMA operation 1.5 ns 4 cycles
L2 cache reference/hit 5 ns 12 ~ 17 cycles
Branch mispredict 6 ns 15 ~ 20 cycles
L3 cache hit (unshared cache line) 16 ns 42 cycles
L3 cache hit (shared line in another core) 25 ns 65 cycles
Mutex lock/unlock 25 ns
L3 cache hit (modified in another core) 29 ns 75 cycles