Skip to content

Instantly share code, notes, and snippets.

View MetroWind's full-sized avatar
🐱
Setting status…

Metro Wind MetroWind

🐱
Setting status…
View GitHub Profile
@MetroWind
MetroWind / everything.cpp
Last active February 7, 2022 07:14
File system watcher for Linux. Currently it doesn’t watch for new directories, but it could be easily added.
#include <system_error>
#include <iostream>
#include <filesystem>
#include <unordered_map>
#include <array>
#include <string>
#include <unistd.h>
#include <sys/types.h>
#include <sys/inotify.h>
@MetroWind
MetroWind / bare.log
Created June 12, 2021 00:20
LMS play logs
-- Journal begins at Thu 2019-06-20 13:29:14 PDT, ends at Fri 2021-06-11 17:12:34 PDT. --
Jun 11 17:10:27 perdido systemd[1]: docker.lms.service: Deactivated successfully.
Jun 11 17:10:27 perdido systemd[1]: Stopped LMS container.
Jun 11 17:10:27 perdido systemd[1]: Starting LMS container...
Jun 11 17:10:27 perdido docker[8632]: Error: No such container: lms
Jun 11 17:10:27 perdido docker[8638]: Error: No such container: lms
Jun 11 17:10:27 perdido systemd[1]: Started LMS container.
Jun 11 17:10:29 perdido docker[8644]: ARG = lms
Jun 11 17:10:29 perdido docker[8644]: ARG = --config=/var/lms/wt_config.xml
Jun 11 17:10:29 perdido docker[8644]: ARG = --docroot=/usr/share/lms/docroot/;/music/resources,/music/css,/music/images,/music/js,/music/favicon.ico
U2FsdGVkX19lCY21RfgdarDUXJV0P/qEiS6vue8m4cI6Jz026MbNECmACkzxafMZxyp9CKCATo7ZcIrb0kYomndSKqkHNVIXrNLqoRiiQ7/bFJIYkpx4cBurodWPx0jJbfWkk/uJs3vFNU7Ig6cdJjX0767FAhLaRiOUf/skzskR3jMmaTW1Ja9GDRSQIEoD8VO1xqaInVdOoAfvuAm2qVczGLPFvAdWTUrIyqNJuM5VPgfz8YRsY2/RAqdCidaEws1elz17ClLjNs6PIVURReysp7aABIY49hMO5G6CyU5P3B4IjJUrjCuUgr6fb0w2wW0LKI5s3hbnHbTgMCqqN6DHX4pJ1JWinm9JEDzcuPNxe7K3iZr/YqDpQhyFGbFkLHJgvyOAkkwjSn7QZrVY9md5gX0FcynAqIMm29fwAdJtPJFTchnvvqFdTl+PKLojzVYwYrDYd5toSIsJUrrd6S/3J/CBPTXxAbMkISINKrI0zGhp4zVEHSp1rR5ziYYtHHivcQIOp1GmpTt08e+g7cBwwPmIonlmHq6LpGkjERPdaZUAuptTWUiWOZub8R9+XiV4ILdCgzua1csvBpgcn/dtgv/S3OMsWp9jqdX3iKpDmpQsO9MhTGgIlTd8NsTlMgnOGb1Hxa78xkge1iqCC0M3lA8QBUmP/eCYHxoQd+BvRfE/ww5NQmr86m8A8+aQUjy0MA8/rRTm1kOs/wP8E5/xP8e7fzNdsrPjuz27lcte9mg/4em+wliNdVZDfCGuMx5I7EysyN/sfr5sU5lFbmgAMB18r+nc48HcVYkJRjfGYF6dUqpoE1e6W7nXaul53eMLrO2yYuOd+GJ/inWn6+7j4ku90s8Lw/CDZ4t/zdlB74OqO7Cz6dTlA4PmOs5SBrExLBtDK9IZpKboQWSLbtRlyrCiZHHxl1tTPvUCZm0HgODox87BxRpT/qYWrvjlF4wn/5RRW+npHnzZf+cuXi3bVofLrqeBPxJgzUsA4szkytsW7rIcr9PRSAlVSGs3
@MetroWind
MetroWind / naive-edge-offset.py
Last active December 13, 2021 07:49
Offset a loop of edges. Probably only works in the simple case where the loop is convex and the internal ordering of the vertices is "nice".
# Offset a loop of edges. Probably only works in the simple case where the loop
# is convex and the internal ordering of the vertices is "nice".
#
# Usage:
#
# 1. In edit mode, select a loop of vertices. The vertices should be roughly on
# the same plane.
# 2. Scroll to the bottom of this file, and change the offset distance in the
# offset function call. The distance can be negative.
# 3. Press "Run Script".
@MetroWind
MetroWind / happy.cpp
Created February 23, 2022 03:46
Check if a number is a “happy number”, constant-space algorithm, with visualization of the algorithm. (https://en.wikipedia.org/wiki/Happy_number)
#include <iostream>
#include <vector>
#include <iomanip>
int sumSqDigits(int n)
{
int result = 0;
while(n > 0)
{
int digit = n % 10;
@MetroWind
MetroWind / Cargo.toml
Created February 26, 2022 04:09
Image cutter
[package]
name = "jqm-cutter"
version = "0.1.0"
authors = ["MetroWind <chris.corsair@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
image = ">=0.24"
@MetroWind
MetroWind / make-shot.sh
Created May 5, 2022 17:54
Combine two screenshots
#!/usr/bin/env zsh
convert -size 1292x928 xc:black -fill white -draw "path 'M 200,0 C 200,800 1500,720 1500,1100 V 2000 H 2000 V -20 H 200 L 200,0'" mask.png
composite dark.png light.png mask.png test.png
convert test.png \( light.png -channel a -separate +channel \) -alpha off -compose CopyOpacity -composite shot.png
rm test.png mask.png
@MetroWind
MetroWind / doraemon.svg
Last active May 18, 2022 04:49
机器猫……
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MetroWind
MetroWind / tests.txt
Created June 10, 2022 22:03
Email validation test
first.last@iana.org
Valid
1234567890123456789012345678901234567890123456789012345678901234@iana.org
Valid
first.last@sub.do,com
Invalid
"first\"last"@iana.org
Valid
first\@last@iana.org
Invalid
@MetroWind
MetroWind / Config.ini
Created June 28, 2022 03:53
Elden Ring PS 5 rune farm
# DS4Emulator by r57zone
# ReadMe: https://github.com/r57zone/DualShock4-emulator
# Key codes: https://github.com/r57zone/Half-Life-Alyx-novr/blob/master/BINDINGS.md
# Support the project: https://r57zone.github.io/support.html
[Main]
ExitBtn=112
InvertX=0
InvertY=0