Skip to content

Instantly share code, notes, and snippets.

@RichardDavies
RichardDavies / feed2js.js
Created October 11, 2011 17:46
Alternate JavaScript implementation of Feed2JS using the Google Feed API
/**
* Feed2JS using the Google Feed API
*
* Inspired by Feed2JS (http://feed2js.org)
*
* Author: Richard Davies (http://www.richarddavies.us)
*
* Example Usage:
* <!-- Requires the Google Loader and API key from http://code.google.com/apis/loader/signup.html -->
* <script src="https://www.google.com/jsapi?key=YOUR_KEY_HERE"></script>
@roadrunner
roadrunner / apc_vs_array.php
Created January 8, 2012 06:23
Speed comparison for APC & Array look-up
<?php
if(!extension_loaded('apc')){
die("APC extension is not enabled.");
}
function generate_class_map($size){
apc_clear_cache('user');
@gplv2
gplv2 / httpd.conf_spiders
Created March 27, 2012 00:57
Apache bot control system, filter out spiders good and bad crawlers/ webspiders when they hit your server hard, like googlebot , bingbot. Block all them for specific places marked in the robots.txt to not visit (yet they do sometimes).
# To relieve servers
##Imagine a robots.txt file like this (Google understands this format):
#User-agent: *
#Disallow: /detailed
#Disallow: /?action=detailed
#Disallow: /*/detailed
#Crawl-delay: 20
##
@vifo
vifo / cpannti.sh
Created May 17, 2012 12:15
Perl: "notest install module" from shell using CPAN
#!/bin/sh
# Usage: cpannti.sh <module_names>
# cpan (i.e. App::Cpan) does not provide a direct way to install modules without
# testing them, as you can do in the CPAN shell with:
#
# cpan[1]> notest install FooBarBaz
#
# App::Cpan uses CPAN::Shell under the hood to perform installation, so let's do
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 31, 2024 09:00
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@tdeckers-cisco
tdeckers-cisco / jetty-ondemand.sh
Created November 30, 2012 09:56
Jetty On-demand - bash bootstrap
#!/usr/bin/env bash
#
# Invoke this bootstrap copying following command to the command line:
#
# bash < <(curl -s -L https://raw.github.com/gist/4174871/jetty-ondemand.sh)
#
# (this should be run as root)
#
# move to working dir.
@daveho
daveho / gist:4369231
Created December 24, 2012 13:10
Perl script to copy a file to an Amazon S3 bucket using Net::Amazon::S3
#! /usr/bin/perl -w
# Really simple script to copy a file to an S3 bucket.
# Credentials are read from ~/.s3credentials, which should
# consist of two lines: the access key id and the secret key.
use strict;
use FileHandle;
use Net::Amazon::S3;
@benders
benders / .bashrc
Created January 16, 2013 20:16
bashrc voodoo for consistently connecting to ssh-agent
# ssh-agent needs to be running and we need to export the SSH_AUTH_SOCK
# environment variable to point to its location in /tmp/ssh-something/agent.PID
# so, find the ssh-agent PID and derive the socket filename from it, and then
# find that file in its randomly-named directory in /tmp and export that for
# ssh to use.
set -x
SSH_AGENT_PID=`pgrep -n -u $USER ssh-agent`
if [ -n "$SSH_AGENT_PID" ]; then
guessed_ppid=`expr $SSH_AGENT_PID - 1`
#!/bin/bash
INSTALL_ROOT="/opt"
INSTALL_FOLDER="$INSTALL_ROOT/elasticsearch"
echo "Installing OpenJDK 1.7.0 ..."
sudo yum install -y java-1.7.0-openjdk
echo "[Installing ElasticSearch...]"
cd ~