Skip to content

Instantly share code, notes, and snippets.

View mhlipson's full-sized avatar
🏆
yeet yeet.

Michael L. mhlipson

🏆
yeet yeet.
View GitHub Profile
tell application "Finder"
-- get desktop dimensions (dw = desktop width; dh = desktop height)
set db to bounds of window of desktop
set {dw, dh} to {item 3 of db, item 4 of db}
end tell
tell application "System Events"
repeat with proc in application processes
tell proc
repeat with win in windows
package com.bigandroidbbq.big_bbq_app.dataLists;
public class ListPeople {
}
@mhlipson
mhlipson / gist:3267210
Created August 5, 2012 21:33
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value={DBInstanceClassMemory/32}, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@mhlipson
mhlipson / sample.C2DM.Messages.php
Created June 5, 2012 02:03
Sample prepared C2DM messages
<?php
$message = array(
'action' => 750, // IntentService Action to be called on the device.
'priority' => 3, // Priority of action called, this would queue the request until later
'input' => 3445 // Control aspect. This could be a 'message' id from the server, or the ID of the blog that was published to fire off the C2DM message.
);
?>
@mhlipson
mhlipson / wordpress.extracturls.php
Created June 4, 2012 01:21
Extract URLs from WordPress post
<?php
/*
Extracts URLs from post content, stores in post_meta in imploded array
RegEX help from: http://ask.amoeba.co.in/regular-expression-in-php-extract-link-text-href/
*/
add_action('save_post','extract_urls');
function extract_urls($post_id){
@mhlipson
mhlipson / class.C2DMParallel.php
Created June 3, 2012 01:58
Call C2DM in parallel using PHP
<?php
/*
class.C2DMParallel.php
PHP Class to send single messages to multiple devices
using Google's C2DM service.
*/
class C2DMParallel{
@mhlipson
mhlipson / linksfromposts.php
Created May 28, 2012 02:39
Extract/save links from posts.. wordpress.
/*
Extracts URLs from post content, stores in post_meta in imploded array
RegEX help from: http://ask.amoeba.co.in/regular-expression-in-php-extract-link-text-href/
*/
add_action('save_post','extract_urls');
function extract_urls($post_id){
if ( !wp_is_post_revision( $post_id ) ) {
@mhlipson
mhlipson / oAuth Credentials
Created May 17, 2012 00:45
Update oAuth credentail
<?php
$url = "https://accounts.google.com/o/oauth2/token";
$fields = array(
'grant_type' => 'refresh_token',
'client_id' => 'CLIENT_ID',
'client_secret' => 'CLIENT_SECRET',
'refresh_token' => 'REFRESH_TOKEN'
);
$ch = curl_init();
@mhlipson
mhlipson / gist:1573694
Created January 7, 2012 03:35
Query WordPress Posts without a custom meta key
<?php
global $wpdb;
$meta_key = ''; // Enter your meta key
$querystr = "SELECT $wpdb->posts.ID
FROM $wpdb->posts
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->posts.post_type = 'post'
AND $wpdb->posts.ID NOT IN (