Skip to content

Instantly share code, notes, and snippets.

@0xSheepdog
0xSheepdog / howto_virt-install_KVM-guest
Last active Nov 6, 2022
howto create a new KVM guest at the CLI with virt-install
View howto_virt-install_KVM-guest
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 \
@mrpeardotnet
mrpeardotnet / PVE-HP-ssacli-smart-storage-admin.md
Created Nov 25, 2019
HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)
View PVE-HP-ssacli-smart-storage-admin.md

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

@spinitron
spinitron / shoutcast-stream-title.php
Last active Apr 6, 2021
Extract and display StreamTitle from a media stream using the Shoutcast Metadata Protocol.
View shoutcast-stream-title.php
<?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 Sep 11, 2019
Install Nginx - php on Ubuntu 18 and Digital Ocean php client
View default
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 Aug 15, 2016
Parsing-ping-results-php (Linux version:icmp_seq)
View gist:253153a920373e55aa52f8a65d156250
<?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 Nov 5, 2015
Redirect outbound traffic to another ip:port
View gist:533a3a76abba0b6404d9
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination IP:80
@fevangelou
fevangelou / my.cnf
Last active Nov 10, 2022
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
View my.cnf
# === 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.
#
@georgy7
georgy7 / extract_mbox_attachments.py
Last active Oct 31, 2022
Extract attachments from mbox file.
View extract_mbox_attachments.py
#!/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"
@fracasula
fracasula / getMp3StreamTitle.php
Last active May 17, 2022
How to get the MP3 metadata (StreamTitle) from a streaming URL
View getMp3StreamTitle.php
<?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';