Skip to content

Instantly share code, notes, and snippets.

<?php
$dir = __DIR__ . '/..';
$keys = [
'mijnkey'
];
$lock = $dir . '/DEPLOY.LOCK';
if (!file_exists($lock)) {
if (isset($_GET['key']) && in_array($_GET['key'], $keys)) {
@GiovanniK
GiovanniK / gist:a8e93807b56b98b97465
Created November 20, 2015 17:03
Laravel outside of public folder
# Disallow access to framework's files
RewriteRule ^(app/|bootstrap/|config/|database|resources|storage|tests|vendor|artisan|composer\.json|composer\.lock|gulpfile\.js|package\.json|phpspec\.yml|phpunit\.xml|readme\.md|server\.php|\.env) - [F,L,NC]
@GiovanniK
GiovanniK / gist:426de8e1f307e7335ba8
Created January 12, 2016 08:30
24 uur, 15 min interval - PHP
<?php
for($i = 0; $i <= 23; $i++) {
// If hour is lower than 10, append a 0
if($i < 10) {
$append = 0;
} else {
$append = '';
}
@GiovanniK
GiovanniK / maps.php
Created March 15, 2016 07:51
Google maps - duratie en afstand berekenen
<?php
function distance($start, $destination)
{
// Send request to Google
$start = urlencode($start);
$destination = urlencode($destination);
$url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=$start&destinations=$destination&mode=driving&language=nl-NL&sensor=false";
// Get response
@GiovanniK
GiovanniK / backup.sh
Last active January 3, 2023 15:50
Linux backup script (local + ftp + sftp)
#!/bin/bash
archiveLocation=/backups
archiveTempPath=/backups/tmp_backup
archiveName=$(date '+%d-%m-%Y_%H:%M');
archiveFullName=$archiveName.tar.gz
archivePath=$archiveLocation/$archiveFullName
deleteLocalArchive=false
backupPath=/var/www
backupToRemoteServer=false
@GiovanniK
GiovanniK / dante_setup.sh
Created February 1, 2019 14:19 — forked from gpchelkin/dante_setup.sh
How To Setup SOCKS5 Proxy Server for (not only) Telegram using Dante on Ubuntu 16.04 / 18.04
### NOT A SCRIPT, JUST A REFERENCE!
# install dante-server
sudo apt update
sudo apt install dante-server
# or download latest dante-server deb for Ubuntu, works for 16.04 and 18.04:
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/dante/dante-server_1.4.2+dfsg-2build1_amd64.deb
# or older version:
wget http://ppa.launchpad.net/dajhorn/dante/ubuntu/pool/main/d/dante/dante-server_1.4.1-1_amd64.deb