This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* using curl | |
*/ | |
$key = 'YOUR_KEY_HERE'; | |
$secret = 'YOUR_SECRET_HERE'; | |
$api_endpoint = 'https://api.twitter.com/1.1/users/show.json?screen_name=marcosfernandez'; // endpoint must support "Application-only authentication" | |
// request token | |
$basic_credentials = base64_encode($key.':'.$secret); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Setup wp_query arguments for the loop. Cache the results for 4 hours. | |
* | |
* @link http://codex.wordpress.org/Transients_API | |
*/ | |
// Check for transient | |
if ( false === ( $my_query = get_transient( 'foo_featured_posts' ) ) ) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failed attempts by username: | |
grep "Invalid user " /var/log/auth.log | cut -d' ' -f8 | awk '{a[$0]++}END{for(i in a)print i,a[i]}' | sort -k 2 -n -r | head -n 100 | |
IP address of each attempt: | |
grep "Invalid user " /var/log/auth.log | cut -d' ' -f10 | awk '{a[$0]++}END{for(i in a)print i,a[i]}' | sort -k 2 -n -r | head -n 100 | |
Filter for brute-force interactive SSH logins: | |
grep sshd.\*Failed /var/log/auth.log | less | |
Look for failed connections (i.e. no login attempted, could be a port scanner, etc.): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function switch_page_template() { | |
global $post; | |
// Checks if current post type is a page, rather than a post | |
if (is_page()) | |
{ | |
// Checks if page is parent, if yes, return | |
if ($post->post_parent == 0) | |
return true; | |
else if ($post->post_parent != $post->ID) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prefilter for caching ajax calls - adapted from | |
* https://github.com/paulirish/jquery-ajax-localstorage-cache, made to work with jqXHR Deferred Promises. | |
* See also $.ajaxTransport. | |
* New parameters available on the ajax call: | |
* localCache : true, // required if we want to use the cache functionality | |
* cacheTTL : 1, // in hours. Optional | |
* cacheKey : 'post', // optional | |
* isCacheValid : function // optional - return true for valid, false for invalid | |
* @method $.ajaxPrefilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../src/Instagram.php'; | |
use MetzWeb\Instagram\Instagram; | |
session_start(); | |
if (isset($_SESSION['access_token'])) { | |
// user authentication -> redirect to media | |
header('Location: success.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Select users in WordPress without specific user meta key | |
-- * Replace meta_name for your meta key | |
-- * Replace > 0 for the minimum user ID | |
SELECT wp_users.ID | |
FROM wp_users | |
WHERE wp_users.ID > 0 | |
AND wp_users.ID NOT IN ( | |
SELECT DISTINCT user_id FROM wp_usermeta WHERE meta_key = 'meta_name' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
If you use short init by passing argument shortinit. | |
You have base and a bit more wp components loaded, like get_meta, current user .. etc. | |
*/ | |
if (!isset( $_POST['action'])) | |
die('-1'); | |
if ( isset( $_POST['shortinit']) ){ | |
$type = trim($_POST['shortinit']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="drop-down-toggle">Click me to reveal drop down box below...</a> | |
<div class="drop-down-wrapper"> | |
Hello, I will be revealed! | |
</div> |