Skip to content

Instantly share code, notes, and snippets.

View natanaeljr's full-sized avatar

Natanael Rabello natanaeljr

View GitHub Profile
@natanaeljr
natanaeljr / 4k-monitor-linux-scale.sh
Last active October 8, 2024 21:39
Configure multi-monitor setup with HiDPI and non-HiDPI in linux
# References:
https://wiki.archlinux.org/title/HiDPI
# Setup monitors
xrandr --output DP-0 --mode 3840x2160 --output HDMI-0 --mode 1920x1080 --pos 3840x0 --filter bilinear --scale-from 3840x2160
# Add to ~/.Xresources
Xft.dpi: 152
# Add to ~/.config/shell/profile
@natanaeljr
natanaeljr / myevent.ics
Created February 28, 2024 23:40
Google Calendar Event: repeat "every last day of month" iCal file to import
# see https://support.google.com/calendar/thread/143707333/repeat-every-last-day-of-month-is-missing?hl=en
BEGIN:VCALENDAR
BEGIN:VTODO
DTSTART:20240229
DTEND:20240229
RRULE:FREQ=MONTHLY;BYMONTHDAY=-1
DESCRIPTION:
LOCATION:
STATUS:CONFIRMED
SUMMARY:Last Day Event
@natanaeljr
natanaeljr / CXXdefaults.md
Created May 19, 2023 20:09 — forked from ax3l/CXXdefaults.md
Compiler C++ Version Defaults

C++ -std=... default of various commonly used C++ compilers

Compiler Version __cplusplus
g++ 4.7.4 199711L
5.5.0 199711L
6.1.0 201402L
10.2 201402L
11.1.0 201703L
clang++ 3.4.2 199711L
@natanaeljr
natanaeljr / plastic_custom.icls
Created January 12, 2023 20:39
Plastic (custom) color scheme for C/C++ for CLion
<scheme name="Plastic custom" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2023-01-12T17:38:06</property>
<property name="ide">CLion</property>
<property name="ideVersion">2022.3.1.0.0</property>
<property name="modified">2023-01-12T17:38:18</property>
<property name="originalScheme">Plastic custom</property>
</metaInfo>
<colors>
<option name="ADDED_LINES_COLOR" value="98c379" />
@natanaeljr
natanaeljr / load-fonts-freetype-opengl.c
Created January 7, 2022 01:35
Loading fonts and baking bitmaps with FreeType for rendering in opengl (partial implementation)
auto load_font_texture(gsl::span<const uint8_t> data, size_t width, size_t height) -> GLTexture
{
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@natanaeljr
natanaeljr / lm-sensors it8688E.md
Last active May 5, 2024 03:55
lm-sensors support for it8688E chip (ArchLinux)

lm-sensors support for it8688E chip (ArchLinux)

  1. Make sure you have installed lm_sensors
  • sudo pacman -S lm_sensors --needed
  1. Download and Install the it87 kernel module for the driver support:
  1. To temporary enable the it87 module
@natanaeljr
natanaeljr / .drirc
Last active February 7, 2021 16:02
Force VSync setting on Linux
<device screen="0" driver="dri2">
<application name="Default">
<option name="vblank_mode" value="1"/>
</application>
</device>
@natanaeljr
natanaeljr / 66-xrandr-monitors.sh
Created December 31, 2020 17:51
Automatic configuration of monitors for my vostro laptop + other monitors - Put this in /etc/X11/xinit/xinitrc.d
#!/bin/sh
# array of connected monitors
monitors=( $(xrandr | grep ' connected ' | cut -d' ' -f1) )
# for the integrated display, set a higher resolution
if [ ${#monitors[@]} -eq 1 ]; then
xrandr --output $monitors --mode 1366x768 --panning 1920x1080 --scale 1.41
# for multiple monitors, enable them all
@natanaeljr
natanaeljr / guide-setup-raspberry-pi.txt
Created October 10, 2020 14:34
Guide to set up the Raspberry PI 3 with ArchLinux ARMv7, plus connect to serial console via telnet
1. Install ArchLinux ARMv7 on the SD card
Follow the guide lines in: https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
2. Configure Serial UART0 to the Linux console
Only need to disable the bluetooth on UART0 to free it to operate as linux console:
Add the following to /boot/config.txt to disable the onboard bluetooth on UART0:
#!/bin/sh
# Module showing CPU load as a changing bars.
# Just like in polybar.
# Each bar represents amount of load on one core since
# last run.
# Cache in tmpfs to improve speed and reduce SSD load
cache=/tmp/cpubarscache