Skip to content

Instantly share code, notes, and snippets.

View smowtion's full-sized avatar

Smowtion smowtion

View GitHub Profile
@smowtion
smowtion / php-fpm-nginx-errorlog.md
Created July 24, 2018 18:59 — forked from joerx/php-fpm-nginx-errorlog.md
redirect php-fpm output to nginx's error log
  • php process is wrapped like this: PHP file -> php-fpm -> nginx
  • basically means disable all facilities that catch output from the script on it's way to nginx
  • standard error output will the end in Nginx's logging facility

On CentOS

  • make sure your script does not set error_log
  • edit /etc/php-fpm.conf, disable line error_log = /var/log/php-fpm/error.log
  • edit /etc/php-fpm.d/www.conf, disable line starting with php_admin_value[error_log] = ...
  • restart fpm: systemctl restart php-fpm
@smowtion
smowtion / ReadMe.md
Created July 31, 2018 10:12 — forked from edm00se/ReadMe.md
Sample nginx.conf settings to perform reverse proxy functionality to.

Read Me

In order to access a server hosted within a vm (guest), for development purposes from the host OS, which is restricted to same origin / localhost only requests, I set up a siple nginx reverse proxy to forward my requests.

Steps

  1. To install in a Windows VM, download and install nginx from the current, stable release; I installed to C:\nginx\
  2. Edit the <install path>/conf/nginx.conf file with the marked changes in the file of the same name in this gist.
  3. Start the nginx executable, located in your install path. There are service wrappers for Windows, or you can just kill the process to stop the nginx instance.

Commands for Windows

@smowtion
smowtion / nginx reverse proxy with dynamic jolokia backend secured by http basic auth Setup nginx as a reverse proxy for jolokia including http basic auth. You might consider - Restrict the backend URL to your jolokia domains - Restrict the `Allow-Origin` Access-Control header to your domain Example Request: http://yourNginxProxy.com?uri=your.dynamic.jolokia.domain/jolokia/
server {
listen 80;
server_name localhost;
access_log /path/to/jolokia.access.log;
location / {
if ($request_method = OPTIONS ) {
add_header Access-Control-Allow-Origin "*"; # <--- customize this
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
@smowtion
smowtion / ratelimiter.php
Created August 23, 2018 08:37 — forked from RobThree/ratelimiter.php
Simple, rude, rate limiter (using memcache).
<?php
/* Very simple, crude, rate limiter */
/*
Assumes _MEMCACHEDSITEPREFIX, _MEMCACHEDHOST and _MEMCACHEDPORT are `defined`:
define('_MEMCACHEDHOST', '127.0.0.1');
define('_MEMCACHEDPORT', 11211);
define('_MEMCACHEDSITEPREFIX', 'mysite');
*/
nserver 208.67.222.222
nserver 208.67.220.220
nscache 65536
timeouts 1 5 30 60 180 1800 15 60
daemon
# http(s)
#auth none
auth strong
@smowtion
smowtion / script.php
Created March 24, 2021 14:26 — forked from barreeeiroo/script.php
PHP Script to integrate UpTimeRobot with Cachet
<?php
ini_set('error_reporting', true);
error_reporting(E_ALL);
$CACHET_URL = "";
$CACHET_KEY = "";
$METRIC_ID = "";
$UPTIMEROBOT_KEY = "";
@smowtion
smowtion / remove_tuxera.sh
Created August 10, 2021 04:22 — forked from miguelmota/remove_tuxera.sh
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
sudo rm -rf /Applications/Tuxera\ Disk\ Manager.app
sudo rm -rf /Library/Application\ Support/Tuxera\ NTFS
sudo rm -rf /Library/Filesystems/fusefs_txantfs.fs
@smowtion
smowtion / disable_gpu.py
Created August 21, 2021 04:06 — forked from AIAnytime/disable_gpu.py
How to disable GPU with TensorFlow?
try:
# Disable all GPUS
tf.config.set_visible_devices([], 'GPU')
visible_devices = tf.config.get_visible_devices()
for device in visible_devices:
assert device.device_type != 'GPU'
except:
# Invalid device or cannot modify virtual devices once initialized.
pass
@smowtion
smowtion / tunnelbroker-net.linux.etc-network-interfaces.sh
Last active September 8, 2021 10:11 — forked from pklaus/tunnelbroker-net.linux.etc-network-interfaces.sh
tunnelbroker.net : tunnel setup on Linux using "ip" from the iproute suite (iproute2)
#!/bin/bash
# IPv6 Tunnel setup of an tunnelbroker.net tunnel on Linux using the configuration file `/etc/network/interfaces`
# (needs the `ip` tool from the iproute suite, Ubuntu package: <http://packages.ubuntu.com/iproute>)
#
# Run like this:
# ./tunnelbroker-net.linux.etc-network-interfaces.sh
#
# 2011 by Philipp Klaus
# Published on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-tunnel-setup-on-ubuntu-11-04/>
@smowtion
smowtion / chromedriver.sh
Created January 9, 2022 14:06 — forked from mikesmullin/chromedriver.sh
easily install chromedriver on linux/osx
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;