Skip to content

Instantly share code, notes, and snippets.

@spinitron
spinitron / shoutcast-stream-title.php
Last active April 6, 2021 02:32
Extract and display StreamTitle from a media stream using the Shoutcast Metadata Protocol.
<?php
/*
* Extract and display StreamTitle from a media stream using the Shoutcast Metadata Protocol.
* Thank you, Scott McIntyre! http://www.smackfu.com/stuff/programming/shoutcast.html
*
* Copyright 2019 by Tom Worster
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
*
@ahmed-abdelazim
ahmed-abdelazim / default
Created September 11, 2019 21:15
Install Nginx - php on Ubuntu 18 and Digital Ocean php client
server {
listen 80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
@leozhang2018
leozhang2018 / gist:253153a920373e55aa52f8a65d156250
Created August 15, 2016 06:25
Parsing-ping-results-php (Linux version:icmp_seq)
<?php
$pingTarget = "baidu.com";
$pingCount = 4;
//It's very important to escape shell arguments to avoid injection attacks.
$output = shell_exec('ping -c'.escapeshellarg((int)$pingCount).' '.escapeshellarg($pingTarget));
if(empty($output))
{
echo "An error occured. Most likely an invalid or unreachable domain.";
exit(1);
}
@didip
didip / gist:533a3a76abba0b6404d9
Created November 5, 2015 17:23
Redirect outbound traffic to another ip:port
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination IP:80
@0xSheepdog
0xSheepdog / howto_virt-install_KVM-guest
Last active November 6, 2022 23:26
howto create a new KVM guest at the CLI with virt-install
source: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-guest_virtual_machine_installation_overview-creating_guests_with_virt_install
The following example installs a virtual machine from an ISO image:
# virt-install \
--name guest1-rhel7 \
--memory 2048 \
--vcpus 2 \
--disk size=8 \
--network default \
--cdrom /path/to/rhel7.iso \
@fracasula
fracasula / getMp3StreamTitle.php
Last active April 24, 2024 00:38
How to get the MP3 metadata (StreamTitle) from a streaming URL
<?php
/**
* Please be aware. This gist requires at least PHP 5.4 to run correctly.
* Otherwise consider downgrading the $opts array code to the classic "array" syntax.
*/
function getMp3StreamTitle($streamingUrl, $interval, $offset = 0, $headers = true)
{
$needle = 'StreamTitle=';
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36';
@mrpeardotnet
mrpeardotnet / PVE-HP-ssacli-smart-storage-admin.md
Created November 25, 2019 22:10
HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

Why use HP Smart Storage Admin CLI?

You can use ssacli (smart storage administrator command line interface) tool to manage any of supported HP Smart Array Controllers in your Proxmox host without need to reboot your server to access Smart Storage Administrator in BIOS. That means no host downtime when managing your storage.

CLI is not as convenient as GUI interface provided by BIOS or desktop utilities, but still allows you to fully manage your controller, physical disks and logical drives on the fly with no Proxmox host downtime.

ssacli replaces older hpssacli, but shares the same syntax and adds support for newer servers and controllers.

Installation

@georgy7
georgy7 / extract_mbox_attachments.py
Last active April 24, 2024 12:12
Extract attachments from mbox file.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Modified.
# Original script source:
# http://blog.marcbelmont.com/2012/10/script-to-extract-email-attachments.html
# https://web.archive.org/web/20150312172727/http://blog.marcbelmont.com/2012/10/script-to-extract-email-attachments.html
# Usage:
# Run the script from a folder with file "all.mbox"
@fevangelou
fevangelou / my.cnf
Last active April 26, 2024 09:12
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#