Skip to content

Instantly share code, notes, and snippets.

View ScuroGuardiano's full-sized avatar
🌕
Moonchild

Scuro Guardiano ScuroGuardiano

🌕
Moonchild
View GitHub Profile
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
/*
* Author: Scuro Guardiano
* License: MIT
* IPv4 address calculator
* Compilation: gcc addy.c -o addy -O3 -lm
* Usage: ./addy address/prefix
*
* NOTE: You must always provide IPv4 address and prefix, otherwise you will get segfault
*
@ScuroGuardiano
ScuroGuardiano / configure_enums_as_string.cs
Created February 16, 2025 18:11
ConfigureEnumsAsString EntityFramework Core
private void ConfigureEnumsAsStrings(ModelBuilder modelBuilder)
{
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
var properties = entity.GetProperties()
.Where(p => p.ClrType.IsEnum);
foreach (var property in properties)
{
modelBuilder.Entity(entity.ClrType)
@ScuroGuardiano
ScuroGuardiano / dirty_triangulations_and_other_mess.c
Created February 3, 2025 04:36
Glow/border shaders, it's unoptimized and terrible for now.
#include "drawing.h"
#include "GL/glew.h"
#include "SDL_log.h"
#include "cglm/struct/vec2.h"
#include "cglm/struct/vec3.h"
#include "sglx/shader.h"
#include "cglm/struct.h"
#include <stdlib.h>
#include <string.h>
@ScuroGuardiano
ScuroGuardiano / glow.frag.glsl
Created January 28, 2025 16:05
My stupid not working properly polygon glow shaders
#version 330 core
out vec4 FragColor;
in vec3 barycentric;
void main() {
float lightThreshhold = 0.01;
float glowWidth = 0.04;
// float softness = 0.0;
vec3 color = vec3(0.98, 0, 0.66);
@ScuroGuardiano
ScuroGuardiano / first.zig
Created May 9, 2024 22:47
My first ever code written in zig.
const std = @import("std");
const print = std.debug.print;
fn clear_input(in_reader: anytype) !void {
try in_reader.skipUntilDelimiterOrEof('\n');
}
pub fn main() !void {
const stdin = std.io.getStdIn().reader();
const stdout = std.io.getStdOut().writer();
@ScuroGuardiano
ScuroGuardiano / tank-min-to-emit.lua
Last active April 12, 2024 03:06
OpenComputers Minecraft mod program, that emits redstone above gas level in gas tank from Mekanism.
local component = require("component");
local shell = require("shell");
local sides = require("sides");
local args, ops = shell.parse(...);
local min_to_extract = tonumber(ops["min-to-extract"]);
local tank_name = ops["tank-name"];
print("GAS TANK MINIMUM TO EXTRACT 2024 PRO\nBy ScuroGuardiano https://github.com/ScuroGuardiano\n\n");
@ScuroGuardiano
ScuroGuardiano / main.rs
Last active April 12, 2024 03:08
Wait... that's illegal!
use std::cell::RefCell;
use std::rc::Rc;
struct State {
value: u64
}
impl State {
pub fn print_value(&self) {
println!("State: {}", self.value);
@ScuroGuardiano
ScuroGuardiano / decodeCDAVideoUrl.js
Last active April 12, 2024 03:09
Code to decoding video url from cda.pl. VideoURL is found in div[player_data] in html source
/* eslint-disable */
var c;
module.exports = function decodeCDAVideoUrl(a) {
String.fromCharCode(('Z' >= a ? 11 : 344) >= (c = a.charCodeAt(0) + 22) ? c : c - 11);
a = a.replace('_XDDD', '');
a = a.replace('_CDA', '');
a = a.replace('_ADC', '');
a = a.replace('_CXD', '');
@ScuroGuardiano
ScuroGuardiano / ShellLikeArgumentParser.cs
Last active April 12, 2024 03:09
ShellLike string split in C#
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace YOUTUBE.WATCH.V.KaAIfdbJSbY
{
class ShellLikeArgumentParser
{
private const string splitPattern = "(([^\"'\\s\\\\]|\\\\'|\\\\\")+)|(\\\\?[\"](\\\\\"|[^\"])+[\"])|(\\\\?['](\\\\'|[^'])+['])";
private const string removeSlashesPatters = "(\\\\(?='))|(\\\\(?=\"))";
// I made typo error: 'Patters' instead of 'Pattern', but I'll leave it here.