Skip to content

Instantly share code, notes, and snippets.

View rutger1140's full-sized avatar
🤖
I use Arch BTW

Rutger rutger1140

🤖
I use Arch BTW
View GitHub Profile
@rutger1140
rutger1140 / simplecache.php
Created March 13, 2014 18:38
Very basic caching script for PHP
<?php
// Example usage
// Set source location
$sourcepath = "http://mysite.com/api/call/something";
// Set cache file
$cacheName = "apicall.cache";
@rutger1140
rutger1140 / gist:9249067
Created February 27, 2014 12:22
IP range notation
11.11.11.11/32 <- just the host 11.11.11.11
11.11.11.0/24 <- the whole 11.11.11.0 network (254 ips)
11.11.0.0/16 <- the 11.11.0.0 network (64k ips)
11.0.0.0/8 <- the 11.0.0.0 network (16million ips)
@rutger1140
rutger1140 / Gruntfile.js
Last active August 29, 2015 13:56
Grunt and bower build scripts for frontend stack of website
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> | <%= pkg.author %> | <%= grunt.template.today("yyyy-mm-dd") %> */\n',
usebanner: {
build: {
options: {
@rutger1140
rutger1140 / .htaccess
Created February 17, 2014 13:10
Protect WordPress login's from unauthorized IP's
# Protect wp-login
<Files wp-login.php>
order deny,allow
deny from all
# Localhost
allow from ::1
allow from 192.168.
# IP from users
@rutger1140
rutger1140 / gist:8548548
Last active November 23, 2023 23:25
Plesk 11.5 nginx configuration settings for WordPress
# Source: https://www.websavers.org/how-to-speed-up-wordpress/
rewrite !\.(js|ico|gif|jpg|png|css|pdf|mov|mp3|eot|svg|ttf|woff|otf|txt|swf)$ /index.php break;
rewrite /wp-admin/$ /wp-admin/index.php break;
rewrite /$ /index.php break;
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner:
'/*! <%= pkg.name %>.js v<%= pkg.version %>\n' +
' * http://<%= pkg.name %>.com/\n' +
' *\n' +
' * <%= pkg.description %>\n' +
@rutger1140
rutger1140 / gravityforms.less
Created November 27, 2013 14:40
Style Gravity Forms with Bootstrap 3 Taken from: http://roots.io/style-gravity-forms-with-bootstrap/
/**
* Gravity Forms styles with Bootstrap 3 mixins
*
* GF settings:
* - Output CSS = No
* - Output HTML5 = Yes
*/
.gform_wrapper ul {
.list-unstyled();
<?PHP
/**
* pingdom.php
*
* This application will check your server swap, hard drive, cpu, and MySQL conditions.
* It will then generate an appropriate XML file for a Pingdom HTTP Custom check.
*
* If any usage is above your preset thresholds, then a down message will be returned,
* indicating that your server may be under more load than usual, hopefully, providing
* a bit of advanced notice before a true failure due to lack of resources
@rutger1140
rutger1140 / list.php
Created November 18, 2013 16:36
List urls from Mathias Bynens URL shortener in a simple table. https://github.com/mathiasbynens/php-url-shortener
<?php
require('config.php');
$db = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
$db->set_charset('utf8');
$result = $db->query('SELECT *, DATE(redirect.date) AS shortdate FROM redirect ORDER BY redirect.date DESC');
// If we have no results
if ($result && $result->num_rows < 0) die('No results');
@rutger1140
rutger1140 / wpinstall.sh
Last active March 21, 2019 19:34
WordPress install script bases on wp-cli - work in progress
#!/bin/bash
# Input database name
echo "---"
echo "wpinstall.sh - A WordPress installation shell script"
echo "by Rutger Laurman"
echo "---"
echo "- Requires WP-CLI, make sure you install that first (http://wp-cli.org/)"
echo "- Check file for configurations"
echo "- Downloads, configures, installs WordPress, default theme and plugins"