Skip to content

Instantly share code, notes, and snippets.

@OneB1t
OneB1t / Force 100 DPI Scale.ps1
Created May 21, 2021 14:04 — forked from itsho/Force 100 DPI Scale.ps1
Force 100% DPI Scaling for all screens even if the default value is different
# =========================================================================================================
# if you like to reset your DPI Scaling to the DEFAULT, you can use the registry (Option five) from here:
# https://www.tenforums.com/tutorials/5990-change-dpi-scaling-level-displays-windows-10-a.html#option5
#
# But, since the default value is different on various monitors, if you like to force 100%,
# you need the following trick:
# for each monitor - set DPIValue to 0xFFFFFFFF (which is -1 in DWord)
#
# Last update: 18 December 2018
# Created by: Itsho
@OneB1t
OneB1t / gist:2241cab4aff77b733bc946880e8fbcaa
Last active September 30, 2023 17:55
bmp generator just with plain java
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;
public class MonochromaticBMPGeneratorWithText {
public static void main(String[] args) {
long start1 = System.currentTimeMillis();
int width = 1280;
int height = 640;
int imageSize = (width + 31) / 32 * 4 * height; // Image size (in bytes)
@OneB1t
OneB1t / gist:7b37e9ac769cec3589623a8cd11ec017
Last active September 30, 2023 21:59
BMP generator in bash
#!/bin/bash
width=1280
height=640
imageSize=$((($width + 31) / 32 * 4 * $height)) # Image size (in bytes)
pixelDataOffset=54 # Offset to pixel data
# BMP header
printf "B" > monochromatic_with_text.bmp
printf "M" >> monochromatic_with_text.bmp
@OneB1t
OneB1t / gist:9a0154ebb27e976e1478e6a904ff1628
Created October 2, 2023 22:42
Python text rendering for loadandshowimage on MIB2
import struct
import time
import random
import subprocess
import platform
start_time = time.time() # Record the start time
# Function to set a pixel to white (255) at the specified coordinates
@OneB1t
OneB1t / gist:740653f17c6a37c27e8c6c82e7195ff1
Created October 3, 2023 15:37
Working python with text changes
import struct
import time
import random
import subprocess
import platform
import threading
import signal
import os
start_time = time.time() # Record the start time