Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
@stenuto
stenuto / hls.sh
Created November 7, 2024 16:58
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@andrasbacsai
andrasbacsai / firewall.sh
Last active November 10, 2024 12:02
Update a Hetzner Firewall rule with your IP address
#!/bin/bash
# Script to update a firewall rule in a Hetzner Firewall with your current IP address.
# Good if you would like to restrict SSH access only for your current IP address (secure).
#################
# WARNING: This script will overwrite all rules in the firewall rules, so make sure you
# added all the required rules.
# I use a separate firewall rule just for SSH access.
#################
@janedbal
janedbal / GarbageCollectorRule.php
Last active October 16, 2024 13:31
Following rule MAY improve PHPStan run time. It makes sense only when you disable GC for PHPStan execution.
<?php declare(strict_types = 1);
namespace ShipMonk\Rules\PHPStan\Rule;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
use PHPStan\Node\InClassNode;
use PHPStan\Rules\IdentifierRuleError;
use PHPStan\Rules\Rule;
use function gc_collect_cycles;
@chrispian
chrispian / getPosts.php
Last active September 27, 2024 18:34
Import WordPress posts, categories, and tags to a Laravel table
<?php
/*
* NOTES:
*
* - This was designed for my personal use and could be more robust.
* - Make sure to update the tables you want to import into.
* - Make sure to update the website url you want to import from.
* - Customize as needed. I had very few posts and no media.
*
*/
# SETUP #
DOMAIN=example.com
PROJECT_REPO="[email protected]:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
# GitHub Action that will run prettier on the whole repo and commit the changes to the PR.
name: Prettier
on:
pull_request:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
@radermacher
radermacher / timelapse.sh
Last active November 3, 2024 19:27 — forked from stenuto/timelapse.sh
Timelapse script; Usage: `timelapse.sh -d 1 -i 3` to record display 1 (main display) with an interval of 3 seconds OR use `timelapse.sh` and manually select display. An interval of 3 is default.
#!/bin/bash
# Check if ffmpeg is installed
if ! command -v ffmpeg &> /dev/null; then
echo "Error: ffmpeg is not installed or not in the PATH." >&2
echo "Please install ffmpeg to use this script." >&2
exit 1
fi
interval=3
@Sammyjo20
Sammyjo20 / Pest.php
Created June 10, 2024 11:14
Lazy Man's Saloon Fake
/**
* Lazy Man's Saloon Fake
*
* This will record every request that you make in your application and store it in a folder
* based on the name of the test. This is incredibly powerful, but I wouldn't recommend it
* for every request if you are doing the same things over as it will waste API calls.
*
* @return void
*/
function lazyFakeSaloon(): void
<?php
namespace App\Livewire\Attributes;
use Attribute;
use Livewire\Features\SupportAttributes\Attribute as LivewireAttribute;
use function Livewire\store;
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
@inxilpro
inxilpro / --usage.php
Created February 13, 2024 17:22
Simple wrapper for OpenSpout
<?php
// Reading
CsvReader::read($path)->each(function(array $row) {
// Do something with $row
});
// Writing
return CsvWriter::for($data)->writeToHttpFile();