Skip to content

Instantly share code, notes, and snippets.

@ulyssesr
ulyssesr / gist:556bc4c1ffb4238b6b666b7180f863c6
Last active December 25, 2020 20:21
LightSail website monitoring script
#!/bin/bash
#setting variables
now=$(date)
domain="https://$1"
log="webmon.log"
#checking if no arguments
if [[ $1 = "" ]]; then
echo "Format: webmon.sh https://domain.com"
@ulyssesr
ulyssesr / readfile.sh
Last active July 14, 2018 19:08
Read from a file. Assign content of file to a variable.
#!/bin/bash
file="/data/buckets.txt"
count=$(cat "$file")
echo "There are $count buckets"
@ulyssesr
ulyssesr / readstring.php
Created November 20, 2017 18:02
Read string in file and place in array
<?php
$file = file_get_contents("filename.txt");
$data = preg_replace("/[^A-Za-z0-9 ]/", '', $file);
$result = preg_split("/[\s,]+/", $data);
echo $result[1];
echo $result[2];
@ulyssesr
ulyssesr / event-if-else.php
Created September 11, 2017 18:20
event-if-else-statement
if($event>$now):
if($event==""):else:$t=$event;endif;
elseif($event1>$now):
if($event1==""):else:$t=$event1;endif;
elseif($event2>$now):
if($event2==""):else:$t=$event2;endif;
elseif($event3>$now):
if($event3==""):else:$t=$event3;endif;
elseif($event4>$now):
if($event4==""):else:$t=$event4;endif;
@ulyssesr
ulyssesr / docker-compose.yml
Last active July 16, 2018 05:15
Docker compose file for Icecast2
version: "2"
services:
icecast:
image: moul/icecast
environment:
- ICECAST_SOURCE_PASSWORD=secret
- ICECAST_ADMIN_PASSWORD=secret
- ICECAST_PASSWORD=secret
- ICECAST_RELAY_PASSWORD=secret
@ulyssesr
ulyssesr / nginx.conf
Last active October 22, 2024 21:47
Nginx RTMP Setup
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;