private void addShortcut(){
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// Shortcut name
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
shortcut.putExtra("duplicate", false); // Just create once
| ==================================================================== | |
| Simple-as-possible instructions to add a field (or more) using South | |
| to an existing Django model with existing data. | |
| ==================================================================== | |
| Two versions: | |
| 1. Super-condensed (the bare minimum - jfdi) | |
| 2. Detailed-but-brief (if you want more information). | |
| Notes: |
| package com.pivotallabs; | |
| import android.util.Log; | |
| import com.xtremelabs.robolectric.Robolectric; | |
| import com.xtremelabs.robolectric.RobolectricTestRunner; | |
| import com.xtremelabs.robolectric.util.Implements; | |
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| @RunWith(RobolectricTestRunner.class) |
| license: gpl-3.0 |
| #!/usr/bin/env python | |
| """ | |
| Very simple HTTP server in python (Updated for Python 3.7) | |
| Usage: | |
| ./dummy-web-server.py -h | |
| ./dummy-web-server.py -l localhost -p 8000 | |
| Send a GET request: |
Locate the section for your github remote in the .git/config file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
| #!/usr/bin/env python | |
| from pygame import camera | |
| import pygame | |
| import time | |
| import cv | |
| import os | |
| # Recognition |
A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.
Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).
| buildscript { | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| classpath 'com.android.tools.build:gradle:0.4' | |
| } | |
| } | |
| apply plugin: 'android' |
| This gist includes oozie workflow components (streaming map reduce action) to execute | |
| python mapper and reducer scripts to parse Syslog generated log files using regex; | |
| Usecase: Count the number of occurances of processes that got logged, by month, and process. | |
| Pictorial overview of workflow: | |
| -------------------------------- | |
| http://hadooped.blogspot.com/2013/07/apache-oozie-part-5-oozie-workflow-with.html | |
| Includes: | |
| --------- |