Skip to content

Instantly share code, notes, and snippets.

View SolveSoul's full-sized avatar
🦑

Axel SolveSoul

🦑
View GitHub Profile
@SolveSoul
SolveSoul / TranslatableModelIdeHelperHook.php
Created September 8, 2023 08:24
A hook to use the barryvdh/laravel-ide-helper in combination with the spatie/laravel-translatable package
<?php
namespace App\Support;
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
use Barryvdh\LaravelIdeHelper\Contracts\ModelHookInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use ReflectionClass;
use Spatie\Translatable\HasTranslations;
@SolveSoul
SolveSoul / ceshi.ini
Created August 18, 2021 08:56
V380 Pro Activate ONVIF/RTSP
[CONST_PARAM]
rtsp = 1 ; RTSPЭ�飬0���ر� 1������
@SolveSoul
SolveSoul / ubuntu-patches-metrics.sh
Created May 26, 2020 06:17
Extracts the pending (security) patches and sends them to AWS CloudWatch as a metric
#!/bin/bash
PATCHES=$(sed '2q;d' /var/lib/update-notifier/updates-available | grep -o '[0-9]*')
SECURITY_PATCHES=$(sed "3q;d" /var/lib/update-notifier/updates-available | grep -o '[0-9]*')
INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
UNIT="Count"
NAMESPACE="System/Linux"
aws cloudwatch put-metric-data --namespace $NAMESPACE --dimensions InstanceId=$INSTANCE_ID --unit $UNIT --metric-name "OperatingSystemUpdates" --value $PATCHES
aws cloudwatch put-metric-data --namespace $NAMESPACE --dimensions InstanceId=$INSTANCE_ID --unit $UNIT --metric-name "OperatingSystemSecurityUpdates" --value $SECURITY_PATCHES
@SolveSoul
SolveSoul / class-import-resolver.js
Created November 20, 2018 08:48
This gist is based upon the answer @ https://stackoverflow.com/a/44440258/4614197 but also checks packages recursively
#!/usr/bin/env node
/*
* A hook to add resources class (R.java) import to Android classes which uses it.
* See: https://stackoverflow.com/a/44440258/4614197
*/
function getRegexGroupMatches(string, regex, index) {
index || (index = 1);
$if($eql(%discnumber%,1/1),$num(%track%,2) $replace(%title%,?,_,/,_,",_,:,_,*,_),$num(%discnumber%,1)-$num(%track%,2) $replace(%title%,?,_,/,_,",_,:,_,*,_))