Skip to content

Instantly share code, notes, and snippets.

@ulyssesr
ulyssesr / readfile.sh
Last active Jul 14, 2018
Read from a file. Assign content of file to a variable.
View readfile.sh
#!/bin/bash
file="/data/buckets.txt"
count=$(cat "$file")
echo "There are $count buckets"
@ulyssesr
ulyssesr / readstring.php
Created Nov 20, 2017
Read string in file and place in array
View readstring.php
<?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 Sep 11, 2017
event-if-else-statement
View event-if-else.php
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 Jul 16, 2018
Docker compose file for Icecast2
View docker-compose.yml
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 Apr 18, 2019
Nginx RTMP Setup
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
You can’t perform that action at this time.