Skip to content

Instantly share code, notes, and snippets.

Ludovic Frank SilentKernel

Block or report user

Report or block SilentKernel

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
View iosHttpd.ts
import {Injectable} from "@angular/core";
import {Httpd} from "@ionic-native/httpd";
import {File} from '@ionic-native/file';
import {Platform} from 'ionic-angular';
import {Subscription} from "rxjs/Subscription";
@Injectable()
export class IosHttpdService {
private readonly serverPort: number = 1210;
private platformIsReady: boolean = false;
View nginx_plex.conf.txt
upstream plex-upstream {
server localhost:32400;
}
server {
listen 80;
server_name mon.domaine.com;
location / {
if ($http_x_plex_device_name = '') {
View -x-accel-redirect-demo.php
<?php
// On recupere la vitesse, renvoie 0 si du texte est entré ici
$speed = intval($_GET["speed"]);
// Le nom du fichier (sur le disque et envoyer au navigateur)
$filename = "ubuntu-14.04.3-desktop-amd64.iso";
/* On évite les valeurs hors sujet pour la vitesse (et on met max 1 mega octet par seconde) */
if ($speed > 0 && $speed <= 1000) {
// Convertie octet en kilo octet
$speed *= 1000;
View nginx-x-accel-redirect-nginx-demo.conf
server {
listen *:80y;
server_name .monsite.fr;
root /homme/www/monsite;
index index.html;
# Cette "Location" n'est accessible qu'en interne, on ne peut pas y
# accéder directement depuis le navigateur.
# ici les fichiers se trouveront dans /home/www/download/ISO/
View freeMobileCheckWebsite.php
<?php
// Sites
$sitesArray[] = "https://silentkernel.fr";
$sitesArray[] = "https://storage.silentkernel.fr";
// Users
$usersUrlArray[] = "https://smsapi.free-mobile.fr/sendmsg?user=xxxxxxx&pass=xxxxxxxxxx&msg=";
// Begin code
function getResponseInfo($url)
View safariIosNewTab.js
var isIOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
function showFacebookShare(control)
{
if (!isIOS)
{
window.open(control.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');
return false;
}
else
View nginx-compagnon.sh
#!/bin/bash
docker pull silentk/nginx-proxy
docker pull jrcs/letsencrypt-nginx-proxy-companion
docker stop nginx-proxy && docker rm nginx-proxy
docker run -d -p 80:80 -p 443:443 --restart always \
--name nginx-proxy \
-v /home/certificates:/etc/nginx/certs:ro \
-v /etc/nginx/vhost.d \
@SilentKernel
SilentKernel / install_pavucontrol.sh
Last active Jul 25, 2017
Utiliser un casque USB sous Debian (2012)
View install_pavucontrol.sh
# https://silentkernel.fr/utiliser-un-casque-usb-sous-debian/
apt-get install pavucontrol
@SilentKernel
SilentKernel / CheckOnline.php
Created Feb 16, 2017
Check if website is online with PHP and Free Mobile (France) / Quick and dirty
View CheckOnline.php
<?php
// Sites
$sitesArray[] = "https://silentkernel.fr";
$sitesArray[] = "https://storage.silentkernel.fr";
// Users
$usersUrlArray[] = "https://smsapi.free-mobile.fr/sendmsg?user=xxxxxxx&pass=xxxxxxxxxx&msg=";
// Begin code
function getResponseInfo($url)
@SilentKernel
SilentKernel / redirect_with_iptables.sh
Last active Feb 16, 2017
Redirect one port to an other host with iptables
View redirect_with_iptables.sh
# Allowing ipv4 forward
echo 1 > /proc/sys/net/ipv4/ip_forward
# Redirect request response to source
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Redirect request on port 80 (TCP) to destionation's ip -> port 80
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination xx.xx.xx.xx:80
# Allow forwarding of this port
You can’t perform that action at this time.