Skip to content

Instantly share code, notes, and snippets.

Louis D. LouWii

Block or report user

Report or block LouWii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LouWii
LouWii / iptables-config-script
Last active Oct 25, 2019
Bash script to configure iptables for a web server. Some rules can be removed depending on used services.
View iptables-config-script
#!/bin/sh
# Empty all rules
sudo iptables -t filter -F
sudo iptables -t filter -X
# Bloc everything by default
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
@LouWii
LouWii / AcmePathRoles.php
Last active Aug 31, 2018 — forked from leotiger/allowed_roles_for_route.md
Symfony3: Check if a route is accessible for a ROLE or a list of ROLES
View AcmePathRoles.php
<?php
namespace Acme\Security\Roles;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Bridge\Monolog\Logger;
@LouWii
LouWii / command.sh
Last active Jun 17, 2018
Convert Flac to MP3 320kbps
View command.sh
# This creates a mp3 folder and will put mp3 files in it after conversion; Requires ffmpeg and libmp3lame codec
# Found in the comments here: http://www.boback.com/2013/how-to-convert-flac-to-mp3-ubuntu-command-line/
# Change the quality using the qscale parameter or change it to -b:a 320k to convert to 320kbps bitrate (see https://trac.ffmpeg.org/wiki/Encode/MP3)
mkdir mp3 && for f in *.flac; do ffmpeg -i "$f" -codec:a libmp3lame -qscale:a 2 -map_metadata 0 "mp3/${f%.*}".mp3; done
@LouWii
LouWii / README-SERVER-SETUP.md
Last active Jan 18, 2017
Simple setup guide for any webserver running Linux
View README-SERVER-SETUP.md
@LouWii
LouWii / Dockerfile
Last active Dec 21, 2016
Dockerfile for a PHP server with Apache and some php extensions pre-installed
View Dockerfile
FROM php:7.0-apache
MAINTAINER louwii@louwii.fr
# Install PHP extensions and PECL modules.
RUN buildDeps=" \
libbz2-dev \
libmysqlclient-dev \
libcurl4-gnutls-dev \
" \
runtimeDeps=" \
@LouWii
LouWii / functions.php
Last active Dec 15, 2016
Force wordpress embedded content to be https
View functions.php
//Add this code to the end of the functions.php file of your wordpress theme
// This forces images urls and links of your website to be displayed with https
function force_https_the_content($content) {
if ( is_ssl() )
{
$content = str_replace( 'src="http://my-domain.tld', 'src="https://my-domain.tld', $content );
$content = str_replace( 'href="http://my-domain.tld', 'href="https://my-domain.tld', $content );
}
return $content;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am louwii on github.
  • I am louwii (https://keybase.io/louwii) on keybase.
  • I have a public key whose fingerprint is ECB5 44C1 9BE3 DA64 96A9 324C D904 BB01 4F59 5F3B

To claim this, I am signing this object:

@LouWii
LouWii / enable_telnet.md
Last active Dec 7, 2016
Scan environment and set the best channel possible on your DJI Phantom 3 Standard controller and drone (requires telnet enabled)
View enable_telnet.md
@LouWii
LouWii / gist:c48bf908a906f7d4da0c
Last active Aug 4, 2016
Apache login protection for specific host
View gist:c48bf908a906f7d4da0c
### If the server is accessed throught the dev URL example.dev
### User will need to authenticate.
SetEnvIf Host ^example\.dev$ require_auth=true
AuthUserFile /Path/To/.htpasswd
AuthName "Password Protected"
AuthType Basic
# Setup a deny/allow
Order Deny,Allow
@LouWii
LouWii / cron-edit.sh
Created Jan 25, 2016
Backup a database using Cron
View cron-edit.sh
# Edit your crontab file using crontab -e command
#
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
You can’t perform that action at this time.