Skip to content

Instantly share code, notes, and snippets.

View octalmage's full-sized avatar

Jason Stallings octalmage

View GitHub Profile
@octalmage
octalmage / screen.js
Created October 6, 2015 21:39
RobotJS screen capture API preview.
var robot = require("robotjs");
var image = robot.screen.capture();
var hex = image.colorAt(25, 25);
console.log("#" + hex);
//#ebebeb
@octalmage
octalmage / send-reads-to-master.php
Last active November 23, 2015 15:19
HyperDB - Send Reads to Master.
<?php
/**
* Plugin Name: Send Reads to Master
* Description: Suggested fix for backend replication lag
* Author: WP Engine
* Version: 0.2
*
*/
if ( is_admin() ) {
@octalmage
octalmage / .travis.yml
Created September 29, 2015 19:14
RobotJS Travis config for Node.js v4.
sudo: false
env:
- CXX=g++-4.8
language: node_js
node_js:
- 0.10
- 0.12
- 4.0.0
- iojs-v2
@octalmage
octalmage / description.md
Last active September 1, 2015 02:34
Terminal Theme.

Default ohmyzsh theme, robbyrussell.

iTerm2 profile below, profile.json.

@octalmage
octalmage / robotjs_alt_tab.js
Created August 11, 2015 10:01
RobotJS - Automate Alt+Tab.
var robot = require("robotjs");
var sleep = require("sleep");
robot.keyToggle('tab', true, 'command');
robot.keyTap('tab', 'command');
sleep.sleep(2);
robot.keyTap('tab', 'command');
sleep.sleep(2);
robot.keyTap('tab', 'command');
@octalmage
octalmage / custom-cache-buddy.php
Created July 19, 2015 13:09
Cache Buddy Filters.
<?php
add_filter('cache_buddy_logged_in_frontend', 'cache_buddy_custom_users', 10, 2);
add_filter('cache_buddy_logged_in_paths', 'cache_buddy_custom_paths', 10, 1);
function cache_buddy_custom_users($cookie, $user)
{
//Return true if the user gets to be logged in on front end. This is only ran when the user logs in.
return false;
}
@octalmage
octalmage / hex.c
Created July 18, 2015 15:39
C padding code - Pad a hex value with leading zeros.
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
int main()
{
int hex = 11100;
//Get length of hex.
int dlen = floor(log10(abs(hex))) + 1;
@octalmage
octalmage / spamhipchat.applescript
Last active January 18, 2017 16:25
Spam Hipchat.
delay 10
repeat 100 times
activate application "HipChat"
tell application "System Events" to keystroke "(parrot) (aussieparrot)"
tell application "System Events" to key code 76
delay 30
end repeat
@octalmage
octalmage / designer.html
Last active August 29, 2015 14:18
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
### Keybase proof
I hereby claim:
* I am octalmage on github.
* I am octalmage (https://keybase.io/octalmage) on keybase.
* I have a public key whose fingerprint is D1E3 8523 50B8 CF90 3CC3 6E8B 6D42 2240 A4B5 E3F4
To claim this, I am signing this object: