Skip to content

Instantly share code, notes, and snippets.

View jcarlos7121's full-sized avatar

Juan Carlos jcarlos7121

View GitHub Profile
@jcarlos7121
jcarlos7121 / Bitmap to Drawable
Created November 22, 2012 21:42
Convert drawable from bitmap on Android
Drawable d = new BitmapDrawable(getResources(),bitmap);
alertDialog.setTitle("Product Information");
alertDialog.setMessage(myProduct.getMyProductInfo());
alertDialog.setButton("Back", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showPrompt();
}
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/usb.h>
static int pen_probe(struct usb_interface *interface, const struct usb_device_id *id)
{
printk(KERN_INFO "[*] Conectado a interfaz (%04K:%04K)\n", id->idVendor,id->idProduct);
return 0;
};
@jcarlos7121
jcarlos7121 / ClientWorker
Created November 24, 2012 08:04
Interaccion Con WorkerService
package directorio.actividades.test;
import java.io.File;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
@jcarlos7121
jcarlos7121 / WorkerService
Created November 24, 2012 08:05
WorkerService inmorible
package directorio.actividades.test;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
como me comento hoy mi amigo Javo algo que pensar, Einstein en su teoria de la relatividad establecio que cuando un objeto se mueve a velocidad luz, viendolo desde la perspectiva de tiempo y espacio, su tiempo y espacio se vuelve 0, y su masa tiende a infinito, (la inversa de 0 es infinito), ahora si nos ponemos a pensar que Dios no se rige bajo tiempo ni espacio...
@jcarlos7121
jcarlos7121 / sm.py
Created November 29, 2012 05:19
Simulacion Optima
""" Market.py
Model of a supermarket.
"""
from SimPy.Simulation import *
import random
from math import sqrt
import math
## Model components ------------------------
@jcarlos7121
jcarlos7121 / .tareas
Created November 30, 2012 05:17
Script para el bro
#EL todo list
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
//Variables Globales
var color = '22E75C';
var seleccion = 0;
var tipoletra = 0;
var tamano = 0;
var tarjeta = 0;
var idtexto = 0;
var textoselected = 0;
var idtemporalimagen = 0;
var userid = 0;
@jcarlos7121
jcarlos7121 / gist:5464840
Created April 26, 2013 03:11
Consulta de amigos por FQL
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var idiiuser = response.authResponse.userID;
FB.api(
{
method: 'fql.query',
query: 'SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = '+idiiuser+') AND is_app_user = 1'
},
function(response) {
console.log("Este es tu json: " + response);
@jcarlos7121
jcarlos7121 / gist:5482294
Created April 29, 2013 15:21
Notifications 2.3.3
@SuppressWarnings("deprecation")
private void generateNotification(Context arg0, String hola) {
// TODO Auto-generated method stub
int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager)
arg0.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, hola, when);
String title = arg0.getString(R.string.app_name);