Skip to content

Instantly share code, notes, and snippets.

View juanjux's full-sized avatar
🏠
Working from home

Juanjo Alvarez Martinez juanjux

🏠
Working from home
View GitHub Profile
@juanjux
juanjux / xrandr_multihead_multidpi.sh
Last active February 12, 2021 22:35
how to set xrandr for multihead X systems mixing normal and high DPI screens
#!/bin/sh
# Note: this works well on Gnome3. KDE 5.7 seems to have issues with the
# framebuffer (toolbars are over the place). 5.9 works well except for
# the desktop background image on the scaled monitor (0 fucks given) but
# for KDE you have to add the xrandr command in another config file:
# http://askubuntu.com/questions/299241/how-to-reset-kde-display-settings-after-a-move-to-a-new-machine
#
# tldr: upscale the lowdpi screen to match the resolution of the hdpi one
# and create a virtual framebuffer resolution that is the size of the combined
# resolutions
@juanjux
juanjux / logmixin.d
Last active April 18, 2017 11:11
Simple mixin to add some log messages to every function call (D language)
module logmixin.d;
/**
This mixin will log at the start and exit
of every call that injects it, including parameter
namess and values. Enter/exit/param messages are
logged only on debug mode. Failures are always logged.
*/
string LogBoilerPlate(string caller=__FUNCTION__)() {
import std.traits: ParameterIdentifierTuple;
@juanjux
juanjux / dataclasses_example.py
Created February 16, 2018 09:34
Python 3.7 data classes
# Old
class MyClass:
def __init__(self, member_init1: int, member_init2: int, member_init3: int):
self.member1 = member_init1
self.member2 = member_init2
self.member3 = member_init3
print('MyClass initialized')
def __str__(self):
print('member1: ', self.member1, ' member2: ', self.member2, ' member3: ', self.member3)