Skip to content

Instantly share code, notes, and snippets.

View dlgg's full-sized avatar

Damien Lesgourgues dlgg

View GitHub Profile
@dlgg
dlgg / nginx-rtmp-stream-multi-debian-18.md
Created May 31, 2023 08:50 — forked from xiCO2k/nginx-rtmp-stream-multi-debian-18.md
RTMP Server to Stream to Facebook, Youtube, Instagram
apt install nginx
apt install libnginx-mod-rtmp
apt install ffmpeg
apt install stunnel4

vim /etc/nginx/nginx.conf

  • Remove http {} and mail {}
@dlgg
dlgg / __upload_file.md
Created November 28, 2017 17:30 — forked from maxivak/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");;
#!/bin/bash
for i in $(tmutil listbackups | head -n $(( $(tmutil listbackups| wc -l) -3 ))); do tmutil delete ${i}; done
@dlgg
dlgg / gist:5b2b5f1ad5d0108bddaffddf2845387e
Created August 31, 2016 14:01 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

@dlgg
dlgg / mkinventory.pl
Created October 16, 2015 17:28 — forked from jamesog/mkinventory.pl
Exporting from RackTables (e.g. for creating an inventory spreadsheet).
#!/usr/bin/env perl
use warnings;
use strict;
# Use modules installed with cpanm -L
use lib 'extlib/lib/perl5';
use DBI;
use POSIX qw(strftime);
use Spreadsheet::WriteExcel;
@dlgg
dlgg / .bashrc_ssh
Last active August 29, 2015 14:15 — forked from mzedeler/.bashrc_ssh
#!/bin/bash
# Set up ssh-agent
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initializing new SSH agent..."
touch $SSH_ENV
chmod 600 "${SSH_ENV}"
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >> "${SSH_ENV}"
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Usage: $0 script args ..."
exit 1
fi
SCRIPT=$1
shift
env -i HOME="$HOME" PATH="$PATH" SHELL="$SHELL" "$SCRIPT" "$@"
@dlgg
dlgg / cacti-1min.sh
Created May 13, 2014 14:32
Cacti poll 5 minutes to 1 minute
for i in {1..70}; do php data_template_associate_rra.php --rra='1:2:3:4:5' --data-template-id=$i; done
mysql cacti -e "update data_template_data SET rrd_step = '60';"
#http://httpd.apache.org/docs/2.2/rewrite/intro.html#rewritecond
#http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
#http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
#Use NOT logic. If cookie doesn't exist then redirect. Otherwise, default behavior.
RewriteCond %{HTTP_COOKIE} !request_method
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/$ /public/ [NE,R,L]
@dlgg
dlgg / fonera.expect
Created November 24, 2013 23:48
Little expect script wich connect to fonera during Redboot, send ^C and go to interactive mode
#!/usr/bin/expect -f
#spawn cu -l /dev/ttyS0 -s 9600
spawn telnet 192.168.1.254 9000
set timeout 3600
# Look for prompt
expect "enter ^C to abort"
send \003
# send blank line (\r) to make sure we get back to gui
#expect "RedBoot>"
interact