Skip to content

Instantly share code, notes, and snippets.

@MatinMN
MatinMN / CommentResource.php
Created September 28, 2023 01:36
Polymorphic relationship in Filament example 1-1 , 1-m
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\CommentResource\Pages;
use App\Filament\Resources\CommentResource\RelationManagers;
use App\Filament\Resources\PostResource\RelationManagers\CommentsRelationManager;
use App\Models\Comment;
use App\Models\Post;
use App\Models\User;
@kmobs
kmobs / DampingRatio.md
Last active May 5, 2024 07:22
Calculating the damping ratio for your hardware:

Prerequisite - Outdated. I don't use the resonance testing branch or pulses method anymore.

I recommend running Dmitry’s latest resonance testing branch and using the pulses method outlined below:

https://github.com/Klipper3d/klipper/issues/4560
https://github.com/dmbutyugin/klipper/tree/resonance-test-methods

I would only go down this path if you're getting ghosting with really high speed prints. On the Annex Engineering K3 for example, no matter how perfect the graphs looked, I was still getting some ghosting. That prompted me to go down this path. I'm now able to print at 20-30k acceleration, 250-350mm/s, and 15scv with perfect quality that can usually only be seen at significantly slower speeds.

The default settings in Klipper have the damping ratio set to .1. This should be fine for most people with sane settings. I like to go for the insane.

@wojteklu
wojteklu / clean_code.md
Last active May 5, 2024 07:12
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@timercrack
timercrack / config.json
Last active May 5, 2024 07:12
openwrt + XRAY 使用 iptables 实现 IPV4 / IPV6 透明代理
{//服务器使用的方案:VLESS+TLS+WS+NGINX+CDN,看情况替换成自己的
"log": {
"access": "/dev/null",
"error": "/var/log/xray_error.log",
"loglevel": "warning"
},
"inbounds": [
{
"tag":"transparent",
"port": 12345,
@Nikhilthadani
Nikhilthadani / index.ts
Created July 2, 2023 11:46
Customized Prisma Client
import { PrismaClient } from "@prisma/client";
let prisma: PrismaClient;
declare global {
namespace NodeJS {
interface Global {
prisma: PrismaClient;
}
}
}
@tenox7
tenox7 / wrp.go
Last active May 5, 2024 07:05
WRP Go Prototype
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"strconv"
"strings"
@ycyr
ycyr / grafana-exporter.sh
Created April 9, 2019 19:05
grafana-exporter
#!/bin/bash
#
# add the "-x" option to the shebang line if you want a more verbose output
#
# set some colors for status OK, FAIL and titles
SETCOLOR_SUCCESS="echo -en \\033[0;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
SETCOLOR_TITLE_PURPLE="echo -en \\033[0;35m" # purple
@nicknapoli82
nicknapoli82 / cs50_Tideman_cycle-explanation.md
Last active May 5, 2024 07:02
My attempt at clarifying how cycles work for the Tideman algorithm

A Way to Look at Tideman Lock Pairs

I've observed that there is a little bit of a disconnect in understanding what it is that needs to be done to properly implement the lock_pairs function for cs50 Tideman. The goal of this little write-up is simply an attempt at explaining what the problem actually is, and why a cycle imposes a problem.

First:
If you are unfamiliar with the actual problem, or have not read through the entire cs50 Tideman problem description. Then I think you should start there.
cs50 Tideman

Second:
This little write-up is only narrowing in on the idea of cycles, and a way to think about what a cycle is and determine if locking a pair in the pairs array would create that cycle. This does not talk about any other part of the Tideman problem.

@xpn
xpn / getsystem_parent.cpp
Created November 20, 2017 00:11
A POC to grab SYSTEM token privileges via PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
#include "stdafx.h"
BOOL SetPrivilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
TOKEN_PRIVILEGES tp;
LUID luid;
TOKEN_PRIVILEGES tpPrevious;
DWORD cbPrevious = sizeof(TOKEN_PRIVILEGES);
if (!LookupPrivilegeValue(NULL, Privilege, &luid)) return FALSE;
@pescode
pescode / Android Icons.jsx
Last active May 5, 2024 07:01
Unity Icons Generator for Win Store, Android & iOS Photoshop Script
// Based on https://gist.github.com/appsbynight/3681050 by Matt Di Pasquale
// Author: Victor Corvalan
// http://twitter.com/pescadon
// This script will generate squares and wide Icons & Tiles required for Windows Store build on Unity3D
// Prepare 1 big icon of 512x512px
// Open this script with Photoshop -> File -> Scripts -> Browse
// Load your icon when prompted
var destFolder;
try