Skip to content

Instantly share code, notes, and snippets.

@ivanoats
ivanoats / Rakefile
Created March 13, 2011 20:42
Rakefile for WordPress and Joomla project deployment from localhost to remote
# Copyright 2011 Ivan Storck
# Rakefile to manage automated local / remote sync of PHP projects like WordPress and Joomla
# Assumptions:
# Git is the version control system
# Only tested with ssh shortcuts in .ssh/config and public keys but should work with username and password too
# for WordPress , .gitignore ignores wp-config.php
# for Joomla, .gitignore ignores configuration.php
require 'rake'
require 'net/ssh'
@stammy
stammy / hack.sh
Created April 1, 2012 09:55 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@pztrick
pztrick / fancyimage_tag.rb
Created June 21, 2012 01:33
Jekyll Image plugin that dynamically creates thumbnails and fancyboxes for uploaded images
# Title: Fancyimage tag for Jekyll
# Authors: Devin Weaver (photos_tag.rb), Brian M. Clapper (img_popup.rb), Patrick Paul (this gist)
# Description: Takes full size image, automagically creates thumbnail at specified size, +fancybox
#
# Adapted from:
# http://tritarget.org/blog/2012/05/07/integrating-photos-into-octopress-using-fancybox-and-plugin/
# (photos_tag.rb) https://gist.github.com/2631877
# (img_popup.rb) https://github.com/bmc/octopress-plugins/
#
# Syntax {% photo filename [tumbnail] [title] %}
@kazu69
kazu69 / pjax.rb
Created March 13, 2012 16:34
Pjax(pushState + Ajax) with Sinatra and BackboneJs
#encoding: UTF-8
require 'rubygems'
require 'sinatra'
require 'erb'
require 'pp'
class Sinatra::Request
def pjax?
env['HTTP_X_PJAX'] || self['_pjax']
@brookr
brookr / config.ru
Created April 16, 2012 04:36
Rackup file I use for running WordPress on Pow
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
@bmccormack
bmccormack / README.md
Last active November 2, 2017 18:40
Get count of tags within a Zendesk search Python script

##Before you begin

This is designed for Python 2.7. You'll need to have the requests package installed.

##Setup

  1. Setup 3 files that correspond to the 3 Python files in this gist within a single folder.
  2. In secrets.py, add your Zendesk account email and token. To get a token, from within Zendesk, go to Settings > API > Token Access (Enabled), then click the plus sign near "Active API Tokens".
  3. In query_zendesk_search_stats_tags.py, change SEARCH and ZENDESK_SUBDOMAIN for your needs.
  4. To run, type python query_zendesk_search_stats_tags.py from the command line and press enter. It will take about 2.5 seconds for each 100 tickets in the search. E.g. 811 tickets took ~22 seconds.
@sandys
sandys / etc_sites_enabled_default.nginx
Created September 4, 2012 06:40
Bulletproof Wordpress installation
proxy_cache_path /var/lib/nginx/cache/staticfiles levels=1:2 keys_zone=staticfilecache:60m inactive=90m max_size=50m;
proxy_temp_path /var/lib/nginx/proxy;
proxy_connect_timeout 30;
proxy_read_timeout 120;
proxy_send_timeout 120;
map $http_cookie $logged_in {
default 0;
~wordpress_logged_in 1; # Wordpress session cookie
@tomislav
tomislav / deploy.rb
Created July 13, 2011 13:12
Capistrano recipe for Wordpress
default_run_options[:pty] = true
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
require 'capistrano'
require 'rubygems'
require 'railsless-deploy'
set :application, "vault42.org"
set :deploy_to, "/usr/local/www/#{application}"
set :backup_dir, "/home/tomislav/backup"
set :use_sudo, false
@juliendsv
juliendsv / gist:3737284
Created September 17, 2012 13:32
Speedup mysql by using RAMDISK
#!/bin/bash
sudo mkdir /db/tmpfs
sudo mount -osize=256m tmpfs /db/tmpfs -t tmpfs
sudo chmod 777 /db/tmpfs
# IMPORTANT edit your /etc/apparmor.d/usr.sbin.mysqld
# to match your new path
# so /var/lib/mysql -> /db/tmpfs/mysql/ (there must be 2 links)
# Then restart apparmor /etc/init.d/apparmor restart
@keimoon
keimoon / fix_heartbleed.sh
Created April 10, 2014 03:57
OpenSSL Heartbleed patch
#!/usr/bin/env bash
DIR=`dirname $BASH_SOURCE`
test "x`whoami`" != "xroot" && echo "Please run as root" && exit
version=`openssl version`
version=${version:0:14}
test "x$version" == 'xOpenSSL 1.0.1g' && echo "OpenSSL version 1.0.1g is OK!!!" && exit
echo -n "Your OpenSSL version is $version. Are you sure to upgrade to 1.0.1g? [Y/n]: "
read confirm
test "x$confirm" != "xY" && echo "Bye" && exit
echo "Checking openssl in /usr/local/bin"