Skip to content

Instantly share code, notes, and snippets.

View MazeW's full-sized avatar
🪻

‮ezaM MazeW

🪻
View GitHub Profile
@MazeW
MazeW / hibernation.md
Last active December 21, 2024 16:19
How to enable hibernation on Arch linux 6.12.4

Enabling Swap and Hibernation on Arch Linux

This only works if you use systemd-boot and not GRUB or anything else.

Follow these steps to enable swap and hibernation on Arch Linux.

1. Check Your RAM and Swap Size

First, check your current RAM and swap usage to ensure the swap file is large enough to store the contents of your RAM:

@MazeW
MazeW / script.js
Created November 22, 2024 23:11
Simple function for getting last.fm user status using native fetch function.
async function getSongInfo(user) {
const url = `https://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user=${user}&api_key=${API_KEY}&limit=1&format=json`;
const response = await fetch(url);
const json = await response.json();
const track = json.recenttracks.track[0];
return { user: json.recenttracks["@attr"].user, artist: track.artist["#text"], name: track.name, image: track.image[track.image.length - 1]["#text"], playing: ((typeof (track["@attr"]) != "undefined") ? true : false) };
}
// example response:
@MazeW
MazeW / README.md
Last active November 4, 2023 06:09

hi

lastfm

@MazeW
MazeW / lastfm 3 char names
Created February 6, 2022 08:54
out of 12500 3 char combo names
bpj
bp6
bqf
bq5
bq6
bq8
bq9
bq0
bse
bs6

Connect ST7789 to ESP32

Wiring

ESP32 ST7789
GND GND
3v3 VCC
D18 SCL
D23 SDA
D4 RES
@MazeW
MazeW / d1mini_relay_wiring.md
Created December 23, 2021 20:55
This is how to connect a tongling relay to a d1-mini (ESP8266)

Connect a 5V relay

I had issues connecting the relay to the wenmos d1-mini (ESP8266 or ESP-12F), turns out you must use the 3v3 pin not 5V.

relay d1
VIN 3v3
GND G
IN D2

You can use any pin you want for IN, but check diagram below for safe GPIO pins that aren't used by something else.

@MazeW
MazeW / nanodisplaytest.md
Last active March 22, 2025 20:59
Connecting an IPS TFT display (ST7789) to an arduino nano and testing image output.

Guide on connecting a ST7789 display to an Arduino Nano.

I recently decided to order an arduino nano and a tft display from AliExpress. When I looked up online it took me some time to find a clear guide how to connect the display to the arduino, either the display had different pins or it was a slightly different model, but with some trial and error, I managed to get it to work.

What you'll need for this:

  • 1x Arduino Nano
  • 1x AdaFruit 1.3" 240x240 ST7789 display
  • 6x jumper wires or whatever else you can use to connect

Connecting display to the arduino

@MazeW
MazeW / order_alphabet.pas
Created September 14, 2020 10:22
10 random english alphabet uppercase letters in order
program order;
uses
crt;
var
a: array[1..10] of char;
d:char;
i,c,r: integer;