Skip to content

Instantly share code, notes, and snippets.

View andreacioni's full-sized avatar

Andrea Cioni andreacioni

View GitHub Profile
@andreacioni
andreacioni / checkpihole.sh
Last active August 12, 2018 08:53
Check if Pi-Hole is up and running and restart it if needed
#/bin/bash
#Tested with Pi-Hole v.4
PI_HOST=localhost
echo "Checking Pi-Hole status"
curl http://$PI_HOST/admin/api.php?summary 2>/dev/null | grep '"status":"enabled"' > /dev/null
if [ $? -eq 0 ]; then
@andreacioni
andreacioni / auto_update_pihole_blocklist.py
Last active January 9, 2023 04:35
Update /etc/pihole/adlist.list of Pi-Hole automatically using the list provided by the WaLLy3K’s blocklist compilation.
#!/usr/bin/python3
'''
Copyright 2018 Andrea Cioni
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the 'Software'),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
@andreacioni
andreacioni / savework.sh
Created July 30, 2018 14:49
Simple script to rewiew & save your work when using GIT
#!/bin/bash
git add .
git status
echo "Hit return to continue..."
read
@andreacioni
andreacioni / linux_handbook.txt
Last active October 2, 2023 22:21
Linux Command Handbook
###### FIND ####
> Execute a command on every subfolder
find -D exec -maxdepth 1 -type d -name "my/directory" -print -exec COMMAND \;
####################### SYSTEMD #######################
> Reload service configuration
@andreacioni
andreacioni / main.go
Created December 29, 2021 21:52
FluentBit Golang Output Telegram Plugin
package main
import (
"C"
"fmt"
"log"
"net/http"
"net/url"
"strings"
"unsafe"
@andreacioni
andreacioni / deepmerge.dart
Created April 3, 2022 16:51
DeepMerge Dart
emptyTarget(val) {
return val is List ? [] : {};
}
dynamic cloneUnlessOtherwiseSpecified(value) {
print('$value');
return isMergeableObject(value)
? deepmerge(emptyTarget(value), value)
: value;
}
@andreacioni
andreacioni / main.dart
Created July 9, 2022 11:34
sliding_text_field_error
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
@andreacioni
andreacioni / app.controller-1.ts
Last active February 4, 2025 14:27
NestJS Authentication: Single Sign On with SAML 2.0
@Get('api/auth/sso/saml/login')
@UseGuards(SamlAuthGuard)
async samlLogin() {
//this route is handled by passport-saml
return;
}
import { KafkaJS } from '@confluentinc/kafka-javascript';
import { SchemaRegistryClient } from '@confluentinc/schemaregistry';
import { DynamicModule, Provider } from '@nestjs/common';
import { HealthIndicatorService } from '@nestjs/terminus';
import { KafkaHealthIndicator } from './kafka.health-indicator';
import { KafkaMetricsProvider } from './kafka.metrics';
import {
KafkaAdminClientOptions,
KafkaConnectionOptions,
KafkaConsumerOptions,