Skip to content

Instantly share code, notes, and snippets.

View c99koder's full-sized avatar

Sam Steele c99koder

View GitHub Profile
@c99koder
c99koder / refinery.lua
Created August 25, 2012 05:42
ComputerCraft lua script to control an IndustrialCraft refinery in Minecraft
-- ComputerCraft oil refinery controller
-- Alternates between two banks of combustion engines so the engines don't overheat and explode
function enableWire(color) -- Turn on a colored wire in the bundle without affecting the other colors
local currentSet = rs.getBundledOutput("back")
if not colors.test(currentSet, color) then
currentSet = colors.combine(currentSet, color)
rs.setBundledOutput("back", currentSet)
end
end
intent = new Intent( Intent.ACTION_VIEW );
intent.setComponent(new ComponentName("fm.last.android","fm.last.android.activity.Tag"));
intent.putExtra("lastfm.artist", "The Postal Service");
intent.putExtra("lastfm.track", "Such Great Heights");
startActivity( intent );
private boolean isLastFmInstalled() {
PackageManager pm = getPackageManager();
boolean result = false;
try {
pm.getPackageInfo("fm.last.android", PackageManager.GET_ACTIVITIES);
result = true;
} catch (Exception e) {
result = false;
}
return result;
intent = new Intent( Intent.ACTION_VIEW );
intent.setComponent(new ComponentName("fm.last.android","fm.last.android.activity.Metadata"));
intent.putExtra("artist", "The Postal Service");
intent.putExtra("track", "Such Great Heights");
startActivity( intent );
Intent intent = new Intent ( Intent.ACTION_VIEW, Uri.parse("lastfm://artist/Radiohead/similarartists"));
startActivity( intent );
package fm.last.android;
public class PrivateAPIKey {
public static final String KEY = "{your API key}";
public static final String SECRET = "{your API secret}";
public static final String ANALYTICS_ID = "";
}
from ws4py.client.threadedclient import WebSocketClient
class DummyClient(WebSocketClient):
def opened(self):
print "Opened websocket"
def closed(self, code, reason=None):
print "Closed down", code, reason
def received_message(self, m):