Skip to content

Instantly share code, notes, and snippets.

Avatar
🎉
if loops

bravokeyl bravokeyl

🎉
if loops
View GitHub Profile
@bravokeyl
bravokeyl / votes_counter.php
Last active Apr 10, 2018
WP Votes counter using rest api
View votes_counter.php
<?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 Mar 15, 2018
Changing MySQL data directory
View mysql.md
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 Mar 3, 2018
Ethminer + NVIDIA +CUDA
View eth.sh
#! /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 Feb 8, 2018 — forked from lucnap/fb-page-access-token-no-expire
How to get a Facebook Page Access Token that doesn't expire Never!
View fb-page-access-token-no-expire
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 Feb 7, 2018
Malware found on a WordPress site's active theme footer.php
View footer.hacked.php
@bravokeyl
bravokeyl / .gitconfig
Created Jan 30, 2018 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
View .gitconfig
#
# 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 Dec 8, 2016 — forked from supinf/s3-invalidation.js
AWS Lambda script:: CloudFront Invalidations which are triggered by s3 events.
View s3-invalidation.js
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;
View Makefile_ARM_explicit
## 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
View instrument-hooks.php
<?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') {