Skip to content

Instantly share code, notes, and snippets.

View iTrooz's full-sized avatar
💭
CODE

iTrooz

💭
CODE
View GitHub Profile
@iTrooz
iTrooz / mouseScroll.py
Last active February 28, 2022 09:19
Simple window with mouse scrolling (PyQt5) (based on https://gist.github.com/acbetter/e7d0c600fdc0865f4b0ee05a17b858f2)
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import sys
import traceback
def exception_hook(exctype, value, a):
@iTrooz
iTrooz / KDE_X11_Wayland_Font.txt
Last active March 2, 2022 21:15
Quick gist : KDE X11 to Wayland Back to X11 cause font problems
Disclaimer : this is a "Quick gist", meaning I won't describe everything that happened precisely. I had a problem, found a solution, here it is
Cause :
Was on ArchLinux KDE 5.23.3 X11, went to Wayland then back to X11, and fonts seemed to be bigger, imgages and panel parts (like the app launcher) too
When creating a new user, they also had these weird settings. Not sure if caused by Wayland changing something system-wide or an recent update in KDE on new sessions
Resolution :
Managed god-know-how to get an user to have a smaller font+images+widgets size
File ~/.config/kdeglobals seems to manage KDE settings
@iTrooz
iTrooz / main.py
Last active October 22, 2024 03:43
reMarkable 2 splash.dat converter
#!/usr/bin/env python3
"""
This script aims at converting an image to the custom format used by Remarkable 2
After running this script, move the output "splash.dat" file to /var/lib/uboot in the rM2 device
I tried this with PNG images but I guess other formats should work too since I use PIL
Syntax: ./main.py <file> [-x xOffset] [-y yOffset]
(-x and -y are the offsets of the image on the screen. If not set, the image will be centered on the screen)
Input images may need to be rotated 90 degrees before converting them
Licence: MPL 2.0
"""
@iTrooz
iTrooz / main.cpp
Created February 19, 2022 00:57
SDL2 Hello World Square Hardware
/*
* Based from https://gist.github.com/cicanci/b54715298ab55dff2fbcd0ca3829d13b
* Basic SDL2 program to render a square using the hardware framework.
* Hope it helps you
*/
#include <SDL2/SDL.h>
int main(){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0){
SDL_Log("SDL_Init Error: %s\n", SDL_GetError());
@iTrooz
iTrooz / glRectF.cpp
Created February 19, 2022 22:57
OpenGL - GLUT square drawing hello world
// See the first file for useful comments
// check other files for useful comments, I may not have left them everywhere (mostly in the first file)
#include <GL/glut.h>
void displayMe()
{
glClearColor(1.0f,1.0f,1.0f,0);
glClear(GL_COLOR_BUFFER_BIT);
@iTrooz
iTrooz / README.md
Created June 1, 2022 07:18
Github markdown custom heading ID on anchor

I recently spent an hour on Googl trying to figure out how to have a custom ID on an anchor, because titles like this

Hello I am a very long title. Why ? Because I wanted to

are quite annoying to reference then

What is what I learned : apparently, there's no way to do it in Github's markdown. There seems to have been a way to do it in the past using ### Some title {#custom-id}

@iTrooz
iTrooz / BONUS.md
Created June 1, 2022 07:20
What are circular imports ?

NOTICE : This is a bonus chapter of the article (to understand header guards). If you are reading this by scrolling past the end of the article... Well you should not do this

Header guards

Now, let's imagine this example (notice I removed the mySecondClass object)

main.cpp

#include "myClass.h"
#include "myUtils.h"
@iTrooz
iTrooz / pause.c
Last active August 12, 2024 13:33
`pause` command C
// Simple program to simulate the `pause` command from Windows. Compile with `gcc -o pause pause.c`
// I'm ofc not going to put a licence on that, do whatever you want with it (CC0)
#include <stdio.h>
#include <unistd.h>
int main(){
printf("My PID: %d\npress any key to continue\n", getpid());
getchar();
return 0;
@iTrooz
iTrooz / main.c
Created July 8, 2022 17:00
Linux XSI message Hello World (msgget msgsnd msgrcv)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/msg.h>
int main(){
char* buf = "Hello world !";
unsigned long len = strlen(buf);
char* buf2 = alloca(len);
@iTrooz
iTrooz / README.md
Last active December 1, 2022 19:58
Huawei Matebook 16 Battery not charging or low CPU frequency on charging (reset battery system)

There previously was a support page with the answer, but since Huawei removed it, here I go (I think it was https://consumer.huawei.com/en/support/content/en-us00692700/)

I had a issue with my ArchLinux KDE computer where sometimes (when I used cpupower-gui I think), my computer would enter a "mode" where charging the computer would reduce the frequency of every core to 400MHz The issue would then appear everywhere, even in the UEFI (and yes, the lag was noticable, even there)

From what I remember, here are the instruction that were on the Huawei support page : (computer on)

  • plug the charging cable
  • Shutdown the computer by force, by holding the power button for 10+ seconds (continue even when it's off !)