Skip to content

Instantly share code, notes, and snippets.

View jasontucker's full-sized avatar

Jason Tucker jasontucker

View GitHub Profile
@norcross
norcross / image-url-fix
Created August 10, 2012 03:38
create clean attachment URLs
// clean URLs for attachments
// http://domain.com/?attachment_id=173
// http://domain.com/attachment/173
function rkv_attachment_urls($wp_rewrite){
$new_rules = array();
$new_rules['media/(\d*)$'] = 'index.php?attachment_id=$matches[1]';
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
@jasontucker
jasontucker / gist:3837819
Created October 5, 2012 03:02
Protect a site using a dyndns host and htaccess.
#!/bin/bash
## Crontab Example:
## #*/3 * * * * /bin/sh ~/htaccessdynamic.sh whatevermydyndnsis.dyndns-remote.com ~/domainiwanttoprotect.com/.htaccess > /dev/null 2>&1
dynDomain="$1"
htaccessLoc="$2"
dynIP=$(/usr/bin/dig +short $dynDomain)
@dylanhthomas
dylanhthomas / excel-remove-trailing-slash.txt
Created June 18, 2013 16:36
Remove the Trailing slash from a cell in Excel. This is especially handy when dealing with lots of urls. Replace "A1" with your cell.
=IF(RIGHT(A1,(LEN(A1)-(LEN(A1)-1)))="/",LEFT(A1,(LEN(A1)-1)),A1)
@cdils
cdils / editor-style.php
Last active March 27, 2020 05:49
Apply theme's stylesheet to the visual editor.
add_action( 'init', 'cd_add_editor_styles' );
/**
* Apply theme's stylesheet to the visual editor.
*
* @uses add_editor_style() Links a stylesheet to visual editor
* @uses get_stylesheet_uri() Returns URI of theme stylesheet
*/
function cd_add_editor_styles() {
add_editor_style( get_stylesheet_uri() );
@Steveorevo
Steveorevo / install.php
Last active April 6, 2016 07:08
Automate your WordPress installation with this WordPress "drop in" (goes in your wp-contents folder).
<?php
echo 'This has been customized!!!';
// Perform post-install customizations
if ( function_exists( 'add_action' ) ){
add_action( 'wp_mail_content_type' , 'customize_install' );
function customize_install(){
// Switch themes
switch_theme('twentytwelve');
@mahemoff
mahemoff / commonfollowers.sh
Created December 1, 2013 00:43
Find common followers of 2 Twitter accounts using https://github.com/sferik/t
#!/bin/bash
t followers $1 > /tmp/followers1.$$.txt
t followers $2 > /tmp/followers2.$$.txt
comm -12 /tmp/followers1.$$.txt /tmp/followers2.$$.txt
@dhrrgn
dhrrgn / gist:10125477
Last active February 26, 2021 18:42
Upgrade Ubuntu OpenSSL to patch Heartbleed
sudo apt-get update
sudo apt-get install -y libssl1.0.0 openssl
# Confirm Build Date is at least Aril 7th 2014
openssl version -a
# Restart all services listed by this command:
sudo lsof -n | grep ssl | grep DEL
#! /bin/bash -x
VBR="2500k"
FPS="30"
QUAL="medium"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
SOURCE="rtsp://xxx.xxx.xxx:554/Streaming/Channels/1"
KEY="xxxxxxxxxxxxxxxx.xxx-xxx-qms4-emuc"
#ffmpeg \
@renatolfc
renatolfc / ovpn-writer.sh
Created December 28, 2014 18:50
Script to generate an OpenVPN client configuration file in the unified format
#!/bin/sh
##
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
##
server=${1?"The server address is required"}
cacert=${2?"The path to the ca certificate file is required"}
client_cert=${3?"The path to the client certificate file is required"}
client_key=${4?"The path to the client private key file is required"}
@gauntface
gauntface / toggle-remote-styles.js
Last active March 12, 2020 12:56
A book marklet to toggle styles.
javascript:(function(){var styles = document.querySelectorAll('link[rel=\'stylesheet\']'); for (var s = 0; s < styles.length; s++) {styles[s].mediax = styles[s].media;if (styles[s].media === 'only x') { styles[s].media = styles[s].mediax; } else if (styles[s].media !== 'print') {styles[s].media = 'only x';}}})();