Skip to content

Instantly share code, notes, and snippets.

View ptts's full-sized avatar
🏠
Working from home

Patrick ptts

🏠
Working from home
View GitHub Profile
@theMiddleBlue
theMiddleBlue / telegram_webhook.php
Created December 22, 2016 08:06
PHP Telegram Webhook
<?php
if(!preg_match('/^149\.154\.167\.(19[7-9]|20[0-9]|21[0-9]|22[0-9]|23[0-3])$/', $_SERVER['REMOTE_ADDR'])) {
die('IP Address not allowed.');
}
if($_SERVER['REQUEST_METHOD'] != 'POST') {
die('Request method not allowed.');
}
$token = '<bot token here>';
@micronax
micronax / unzip.php
Created December 28, 2015 19:09
Small PHP-Script with GUI to unzip files in current directory
<?php
echo '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">';
echo '<div class="container" style="margin-top:50px;">';
if (!class_exists('ZipArchive')) {
die("<h1>ZipArchive is not installed. Pleas echeck php.ini</h1>");
}
@alysivji
alysivji / keybindings.json
Last active September 18, 2020 15:21
VSCode Settings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+g",
"command": "editor.foldAll",
"when": "editorTextFocus"
},
{
"key": "cmd+h",
"command": "editor.unfoldAll",
@ivanionut
ivanionut / nginx-proxy.conf
Created June 3, 2020 14:26 — forked from fhferreira/nginx-proxy.conf
Proxy nginx to use Google Tag Manager
# Google Analytics Bypassing Adblockers
## Client
change www.googletagmanager.com => your.domain.com
```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://your.domain.com/gtag/js?id=UA-123456789-1"></script>
```
@NickHatBoecker
NickHatBoecker / move-wordpress.sh
Last active December 21, 2020 10:26
Moving Wordpress: Update SQL Statements
#!/bin/bash
#
# This script is used to update database url entries for wordpress.
#
# © Nick Böcker <https://nick-hat-boecker.de> 2019
# User input mysql username
read -p "Enter mySQL username [root]: " USER
USER=${USER:-root}
@allebb
allebb / create_php_site.sh
Created September 12, 2017 15:54 — forked from jun9/create_php_site.sh
Nginx and PHP-FPM, bash script for creating new vhost’s under separate fpm pools
#!/bin/bash
# @author: Seb Dangerfield
# http://www.sebdangerfield.me.uk/?p=513
# Created: 11/08/2011
# Modified: 07/01/2012
# Modified: 17/05/2012
# Modify the following to match your system
NGINX_CONFIG='/etc/nginx/sites-available'
NGINX_SITES_ENABLED='/etc/nginx/sites-enabled'
Source: https://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
This page collects hints how to improve the security of nginx web servers running on Linux or UNIX-like operating systems.
Default Config Files and Nginx Port
/usr/local/nginx/conf/ or /etc/nginx/– The nginx server configuration directory and /usr/local/nginx/conf/nginx.conf is main configuration file.
/usr/local/nginx/html/ or /var/www/html– The default document location.
/usr/local/nginx/logs/ or /var/log/nginx – The default log file location.
Nginx HTTP default port : TCP 80
@dysinger
dysinger / simple-nginx-webdav.sh
Created January 5, 2010 20:32
A simple nginx/webdav setup for use with things like mobile-org
#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \
@rnorth
rnorth / gist:2031652
Created March 13, 2012 21:14
Cookie-based authentication with nginx
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
@cweinberger
cweinberger / mysql-drop-all-tables.sh
Created June 6, 2018 12:44
drops all tables of a specific db
#!/bin/bash
#usage: mysql-drop-all-tables -d database -u dbuser -p dbpass
TEMP_FILE_PATH='./drop_all_tables.sql'
while getopts d:u:p: option
do
case "${option}"
in