Skip to content

Instantly share code, notes, and snippets.

View bravokeyl's full-sized avatar
🎉
if loops

bravokeyl bravokeyl

🎉
if loops
View GitHub Profile
@bravokeyl
bravokeyl / votes_counter.php
Last active April 10, 2018 07:09
WP Votes counter using rest api
<?php
/*
Update post meta based on the action taken on the post
*/
function mubit_update_votes($id, $key, $action) {
$data = array();
if(empty($id) || empty($action) || empty($key)) {
return $data;
}
$votes = get_post_meta($id, $key, true);
@bravokeyl
bravokeyl / mysql.md
Created March 15, 2018 07:19
Changing MySQL data directory
sudo service mysql stop
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
sudo nano /etc/apparmor.d/tunables/alias
sudo systemctl restart apparmor

Don't forget to change ownership of the new datadir to mysql

@bravokeyl
bravokeyl / eth.sh
Created March 3, 2018 06:02
Ethminer + NVIDIA +CUDA
#! /bin/sh
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
cd /usr/
@bravokeyl
bravokeyl / fb-page-access-token-no-expire
Created February 8, 2018 18:20 — forked from lucnap/fb-page-access-token-no-expire
How to get a Facebook Page Access Token that doesn't expire Never!
How to get a Facebook Page Access Token that doesn't expire Never!
- Go to http://developers.facebook.com/tools/explorer/
- Get a User Access Token with a permission "manage_pages"
- Convert this short-lived access token into a long-lived one by making this Graph API call:
https://graph.facebook.com/v2.6/oauth/access_token?client_id=<your FB App ID >&client_secret=<your FB App secret>&grant_type=fb_exchange_token&fb_exchange_token=<your short-lived access token>
- Make a call Graph API:
https://graph.facebook.com/v2.6/<your personal account FB user id>/accounts?access_token=<your long-lived access token>
- The returned access_token has no expiration unless you change your password or not more admin of the target page or deauthorize FB page
@bravokeyl
bravokeyl / footer.hacked.php
Created February 7, 2018 07:03
Malware found on a WordPress site's active theme footer.php
@bravokeyl
bravokeyl / .gitconfig
Created January 30, 2018 18:47 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@bravokeyl
bravokeyl / s3-invalidation.js
Created December 8, 2016 13:52 — forked from supinf/s3-invalidation.js
AWS Lambda script:: CloudFront Invalidations which are triggered by s3 events.
console.log('Loading event');
var Q = require('q');
var aws = require('aws-sdk');
var cloudfront = new aws.CloudFront();
exports.handler = function (event, context) {
//_log('Received event: ', event);
var bucket = event.Records[0].s3.bucket.name;
## Cross-compilation commands
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
AR = arm-none-eabi-ar
AS = arm-none-eabi-as
OBJCOPY = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump
SIZE = arm-none-eabi-size
# our code
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {