Skip to content

Instantly share code, notes, and snippets.

@aaronpk
aaronpk / gist:5846789
Last active April 6, 2025 02:26
Added WebFinger support to my email address using one rewrite rule and one static file.
[[email protected] www]$ cat .htaccess
RewriteEngine on
RewriteCond %{QUERY_STRING} resource=acct:(.+)
RewriteRule ^\.well-known/webfinger /profile/%1? [L]
[[email protected] www]$ cat profile/[email protected]
{
"subject": "acct:[email protected]",
"links": [
{
@ttscoff
ttscoff / grab links.bookmarklet
Last active February 20, 2025 09:55
Create a bookmark and paste the code from `grab links.bookmarklet` into the url. Trigger it on a page containing links you want to save and then click the section of the page containing the links. A Markdown list of all links will be generated, and clicking the resulting list will select all for copying.
<?php
function github_markdown($text) {
$ch = curl_init('https://api.github.com/markdown/raw');
curl_setopt_array($ch, array(
\CURLOPT_POST => true
, \CURLOPT_RETURNTRANSFER => true
, \CURLOPT_POSTFIELDS => $text
, \CURLOPT_SSL_VERIFYPEER => false
, CURLOPT_HTTPHEADER => array('Content-Type: text/plain')));
<?php
/* Shorten a URL using Google's goo.gl API. Requires an API key. */
function googl_shorten_url($url, $api_key) {
$endpoint = 'https://www.googleapis.com/urlshortener/v1';
$ch = curl_init(sprintf('%s/url?key=%s', $endpoint, $api_key));
curl_setopt_array($ch, array(
\CURLOPT_POST => true
, \CURLOPT_AUTOREFERER => true
, \CURLOPT_FOLLOWLOCATION => true
, \CURLOPT_SSL_VERIFYPEER => false
@grindars
grindars / steam_bootstrap.sh
Created December 7, 2012 07:53
Steam installer for Debian
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"
@tekapo
tekapo / example.php
Created November 16, 2012 05:37 — forked from wokamoto/example.php
how to use class-wp_post_helper
<?php
require_once('/path/to/wordpress/wp-load.php');
require_once('class-wp_post_helper.php');
// initialize
$post = new wp_post_helper(array(
'post_name' => 'slug' , // slug
'post_author' => 1 , // author's ID
'post_date' => '2012/11/15 20:00:00' , // post date and time
'post_type' => 'posts' , // post type (you can use custom post type)
@Angles
Angles / HISTIGNORE-info.txt
Created August 6, 2012 11:03
HISTIGNORE what's the deal
###
####### HISTIGNORE #######
###
# examples from interwebs, noob dot file notes
#export HISTIGNORE='pwd:exit:fg:bg:top:clear'
# (if try to erasedups do not ignore things want 2 pune but on OSX it no workie)
# ignore things that start with a space, and ignore the exit command
#HISTIGNORE='[ \t]*:exit'
# some slashdot dudes says
#export HISTIGNORE="&:ls:[bf]g:exit:pwd:clear:mount:umount:[ \t]*"