Skip to content

Instantly share code, notes, and snippets.

View florianvazelle's full-sized avatar
🌋
GPU @ 2000%

florianvazelle

🌋
GPU @ 2000%
View GitHub Profile
override_utf8_locale yes
use_xft yes
xftfont ubuntu:size=10.5
xftalpha 0.5
uppercase no
no_buffers yes # Subtract cached and buffered ram from memory usage.
display :0.0
nvidia_display :0.0
text_buffer_size 2048

Adding elements to a vector

There are several ways to add data to a vector:
  • create an empty vector, push_back() elements into it.
  • create an empty vector, allocate some capacity with reserve(), then push_back() elements into it.
  • create a vector of n elements, use indexing and copy-assignment.
  • create an empty vector, emplace_back() elements into it.
  • create an empty vector, allocate some capacity with reserve(), then emplace_back() elements into it.

There are other ways, e.g. creating the container with a pair of iterators, or filling it via standard library algorithms. I won't consider these here.

@florianvazelle
florianvazelle / Basic.frag
Last active February 10, 2021 12:27
Simple Illumination Shader in GLSL
#version 450
layout(location = 0) in vec3 inNormal;
layout(location = 1) in vec3 inLightVec;
layout(location = 2) in vec3 inViewVec;
layout(binding = 1) uniform Material {
vec3 Ambient;
vec3 Diffuse;
vec3 Specular;
# Git branch name in prompt
if [ "$color_prompt" = yes ]; then
PS1="\[\033[95m\]\u@\h \[\033[32m\]\W\[\033[33m\] [\$(git symbolic-ref --short HEAD 2>/dev/null)]\[\033[00m\]\$ "
else
PS1="\u@\h \W [\$(git symbolic-ref --short HEAD 2>/dev/null)]\$ "
fi
# Docker shortcuts
alias dps='docker-compose ps'
alias dlogs='docker-compose logs --tail 50 -f '
@florianvazelle
florianvazelle / README.md
Last active May 21, 2022 13:33
Minimal example of an "ASGI-like" streaming server with Twisted

To execute this example:

  • in a terminal, run:
python async_stream_server.py
  • in another terminal, run:
curl http://localhost:1234/
@florianvazelle
florianvazelle / xinput.sh
Created October 16, 2022 08:41
xinput command
# List all built-in and external input devices connected to the system
xinput --list
# See current status and various options active for a device
xinput --list-props <device_id>
# To enable or disable an option
xinput set-prop <device_id> <option_id> <0,1>
# For example, to allow the use of the keyboard and the mouse at the same time:
# godot --editor --quit
# godot -- --run-benchmarks
extends Benchmark
const ITERATIONS = 1_000
const EXAMPLE_TEXT := """
[snd 0][spd 0.3]///initialization basic test.com... [wait 60]", "[inst 4]done[wait 60] ", "[b]Press ENTER to execute test...[/b]", "Test 1: [wait 60] Rendering [wait 60]