Skip to content

Instantly share code, notes, and snippets.

View jmathai's full-sized avatar

Jaisen Mathai jmathai

View GitHub Profile
@jmathai
jmathai / twitter_oauth_image_upload.php
Created June 11, 2009 03:44
Upload photos to Twitter's OAuth API using PHP
// This uses twitter-async from GitHub
// Source: https://github.com/jmathai/twitter-async/tree
// Documentation: http://wiki.github.com/jmathai/twitter-async
include 'EpiOAuth.php';
include 'EpiTwitter.php';
$twitterObj = new EpiTwitter('YourConsumerKey', 'YourConsumerSecret', 'Token', 'TokenSecret');
$params = array('@image' => '@/absolute/path/to/image.jpg');
$uploadResp = $twitterObj->post_accountUpdate_profile_image($params);
# convert a unix timestamp into a readable date
date -d @1252374518
#!/bin/bash
# Ease staging of files
for i in $(git status | grep -A 10000 "not updated" | grep modified) ; do
if [ -f $i ] ; then
git diff $i;
echo -n "Add this to stage? [y/n]: ";
read ans;
if [ "$ans" == "y" ] ; then
@jmathai
jmathai / function.php
Created February 4, 2011 16:19
function.php
<?php
/*
* This is a sample function that guarantees unique URLs for frontend assets.
* Images for example.
* Include this and your users will never re-download an asset they already
* have just just because you push a new build.
* If including this in your stylesheet then you should set this up in you
* should be using something like Amazon Cloud Front to cache a static
* version of it.
*/
@jmathai
jmathai / adb-logcat.txt
Created November 11, 2011 08:00
OpenPhoto logcat from Android
--------- beginning of /dev/log/system
D/WifiService( 129): acquireWifiLockLocked: WifiLock{NetworkLocationLocator type=2 binder=android.os.BinderProxy@408bf5f0} Mode: 2
D/WifiService( 129): disable wifi due to updateWifiState
D/WifiService( 129): releaseWifiLockLocked: WifiLock{NetworkLocationLocator type=2 binder=android.os.BinderProxy@408bf5f0} Mode: 2
D/WifiService( 129): disable wifi due to updateWifiState
D/StatusBarPolicy(32056): hasService()=true ,mDataState=2 ,mPhone.htcModemLinkOn()=false ,mDataActivity=0
D/StatusBarPolicy(32056): slotType[0]=empty
D/StatusBarService(32056): updateIcon slot=data_connection index=18 viewIndex=13 old=StatusBarIcon(pkg=com.android.systemui id=0x7f020015 level=0 visible=true num=0 ) icon=StatusBarIcon(pkg=com.android.systemui id=0x7f020015 level=0 visible=true num=0 )
D/WifiService( 129): acquireWifiLockLocked: WifiLock{NetworkLocationLocator type=2 binder=android.os.BinderProxy@408bf5f0} Mode: 2
D/WifiService( 129): disable wifi due to updateWifiState
@jmathai
jmathai / embed_image.markdown
Created December 2, 2011 20:35
Display an image in a Github issue

@jmathai
jmathai / openphoto.pp
Created February 15, 2012 18:34
OpenPhoto puppet script
class openphoto {
exec { "apt-update":
command => "/usr/bin/apt-get update",
refreshonly => true;
}
# base
package {
"exiftran" :
ensure => installed,
@jmathai
jmathai / aws-iam-for-openphoto
Created April 24, 2012 00:52
Sample AWS IAM for OpenPhoto
# use the s3:* and/or sdb:* depending on which you'll need
# sdb domain prefix can be any string.
# s3 bucket names are globally unique
# your account id should not have any spaces or dashes
{
"Statement": [
{
"Sid": "StmtNNNNNNNNNNNNN",
"Action": "s3:*",
@jmathai
jmathai / fix-tag-counts-openphoto.php
Created May 18, 2012 20:44
Fix tag counts in db
<?php
$host = '***';
$user = '***';
$pass = '***';
$dbname = '***';
$owner = 'user@example.com';
$conn = mysql_connect($host,$user,$pass);
mysql_select_db($dbname);
@jmathai
jmathai / virtualbox-guest-addition-update
Created May 25, 2012 03:04
Upgrades virtualbox to guest additions 4.1.8
wget -c http://download.virtualbox.org/virtualbox/4.1.8/VBoxGuestAdditions_4.1.8.iso
sudo umount /mnt
sudo mount VBoxGuestAdditions_4.1.8.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run