Skip to content

Instantly share code, notes, and snippets.

@AndisGrossteins
AndisGrossteins / .htaccess
Last active October 11, 2019 01:54
A hack to log real IP addresses on share Apache hosting behind CloudFlare (or other) reverse proxy
# Set environment variables from request headers and add them to User-Agent header
# it's not much but it works
# Requirements:
# 1 - mod_setenvif (http://httpd.apache.org/docs/current/mod/mod_setenvif.html)
# 2 - mod_headers (http://httpd.apache.org/docs/current/mod/mod_headers.html)
<IfModule mod_setenvif.c>
# Add envirinment variables from a request header
SetEnvIf CF-Connecting-IP "^(.+)$" CF_Connecting_IP=$1
@hitautodestruct
hitautodestruct / reset.md
Created July 17, 2018 12:58
Reset root password on scaleway.com
@laacz
laacz / wp-update.sh
Last active December 13, 2017 14:45
Find ordpresses and update them (plugins too)
#!/usr/bin/env bash
#
# Script will find all wordpress installs and check if they're out of date
#
# Using wp-cli - http://wp-cli.org/
# Paths to search for wordpresses. Separated by space.
PATHS="/var/www /data/www"
# Paths to ignore (should not be checked). Separated by space.
@waja
waja / create_debian-sys-maint_for_mysqladmin.sh
Last active April 18, 2022 18:57
Create 'debian-sys-maint' MariaDB user for use of mysqladmin. Just in case you can't use 'root' via 'unix_socket' plugin.
#!/bin/sh
MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf"
# generate password
PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)');
# adjust /etc/mysql/debian.cnf (used as defaults file by system scripts)
sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf
sed -i "s/^user =.*$/user = debian-sys-maint/" /etc/mysql/debian.cnf
# create config file for mysqladmin itself (maybe not needed)
umask 066
cat > ${MYSQLADMIN_CFG} <<EOF
@royshouvik
royshouvik / remoteDebugging.md
Last active September 17, 2024 02:12
Describes how to setup remote debugging on an Android device using Chrome

Remote Debugging on Android with Chrome

The way your web content behaves on mobile can be dramatically different from the desktop experience. Remote debugging with Chrome DevTools lets you debug live content on your Android device from your development machine.

Debugging Chrome for Android using the Chrome Developer Tools

Remote debugging on Android supports:

  • Debugging websites in browser tabs.
  • Debugging WebViews in native Android apps.
@Gazer
Gazer / localhost.conf
Last active October 20, 2021 14:55
Nginx example to redirect users to a "Comming soon portal" if they are not developers.
server {
listen 80;
server_name localhost;
location @until {
# Static "comming soon" directory with index.html and assets
root /var/www/;
index index.html;
}
@zhaostu
zhaostu / remove_residual_config.sh
Created October 21, 2012 19:16
One-liner to remov all residual config packages in Ubuntu
# Remove all the packages with residual configuration.
# http://stuzhao.blogspot.com/2012/07/removing-all-residual-config-packages.html
sudo apt-get remove --purge `dpkg -l | grep '^rc' | awk '{print $2}'`
@funkatron
funkatron / slim_catchall_route.php
Created December 8, 2011 14:48
Making a "catchall" route in Slim
<?php
/**
* by setting the regex condition for the :method param to '.+', it matches
* everything, including "/" chars. this lets us match any URL of the format.
*
* /api/foo outputs "foo"
* /api/foo/bar/baz outputs "foo/bar/baz"
*/
$app->get('/api/:method', function($method) use ($app) {
echo $method;