This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ============================================================================== | |
# Proxmox VE - Single Node DHCP Configuration Script (Updated) | |
# | |
# This script automates switching a single Proxmox VE node from a static IP | |
# to DHCP. It is configured to: | |
# 1. Prefer IPv4 addresses over IPv6. | |
# 2. DE-PRIORITIZE IPv4 addresses in the 100.0.0.0/8 network range. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Readable } = require('stream'); | |
const { pipeline } = require('stream/promises'); | |
const pipe = require('pipeline-pipe'); | |
async function process(a) { | |
await sleep(100); | |
return a; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Enums; | |
use App\Casts\EnumCast; | |
use Illuminate\Contracts\Database\Eloquent\Castable; | |
abstract class Enum extends \Spatie\Enum\Enum implements Castable | |
{ | |
public static function castUsing() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use App\Models\User; | |
use Illuminate\Http\Resources\Json\JsonResource; | |
/** @mixin \App\Models\User */ | |
class UserResource extends JsonResource | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
//...composer.json content | |
"scripts": { | |
//...existsing scripts | |
"post-update-cmd": [ | |
"Illuminate\\Foundation\\ComposerScripts::postUpdate", | |
"@php artisan nova:publish", | |
"@php artisan ide-helper:generate", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function calcControlBit(array $input, array $controllingBits): int | |
{ | |
$ones = 0; | |
foreach ($controllingBits as $bit) { | |
if ($input[$bit] === 1) { | |
$ones++; | |
} | |
} |