Skip to content

Instantly share code, notes, and snippets.

View maluta's full-sized avatar

Tiago Maluta maluta

View GitHub Profile
@maluta
maluta / r1.py
Created February 10, 2012 19:46
#!/usr/bin/python
import re
s="sesc_simulation_mark 3 (simulated) @7126013\naccumalated energy is: 291709047.314"
#for i in re.findall('[-+]?[0-9]*\.?[0-9]*',s):
# if i != '':
# print i
print [i for i in re.findall('[-+]?[0-9]*\.?[0-9]*',s) if i != '']
from: http://www.beagleboard.org/irclogs/index.php?date=2009-03-06
echo "dvi e:1 u:1 t:0 h:1280/110/220/40 v:720/20/5/5 p:72000 " > /sys/devices/platform/omapfb/displays
@maluta
maluta / gist:1611983
Created January 14, 2012 16:41
snippet to split *.patch that contains kernel_imx word.
import glob
import os
patches = glob.glob("*.patch")
kernel = []
framework = []
for patch in patches:
print patch
git branch --track kernel_2.6.35.3_android_p4 remotes/origin/kernel_2.6.35.3_android_p4
git checkout kernel_2.6.35.3_android_p4
setenv bootargs 'console=ttyO2,115200n8 androidboot.console=ttyO2 rw root=/dev/mmcblk0p2 rootfstype=ext3 rootdelay=1 init=/init vram=12M omapdss.def_disp=dvi omapfb.mode=dvi:1024x768@60'
mmc rescan ; fatload mmc ${mmcdev}:1 ${loadaddr} uImage ; bootm ${loadaddr}
#include <stdio.h>
int main (int argc, char *argv[]) {
unsigned char bin=0b1010;
unsigned char oct=012;
unsigned char hex=0xA;
unsigned char dec=10;
unsigned char mask=1<<3|0<<2|1<<1|0;
@maluta
maluta / w.c
Created October 21, 2011 19:14
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
FILE *f = fopen("/tmp/maluta.txt","wb");
char x[17]="www.coding.com.br";
fwrite(x, sizeof(x[0]), sizeof(x)/sizeof(x[0]), f);
fclose(f);
/* g++ callback.cpp -o callback */
#include <stdint.h>
#include <iostream>
class Memory{
public:
Memory() { std::cout << "Memory()" << std::endl; };
~Memory(){ std::cout << "~Memory()" << std::endl;};
/*
External customized tags.
gcc -DTAG=\"Hello\ World\!\" tag.c -o tag
*/
#include <stdio.h>
int main (int argc, char *argv[]) {
printf("%s\n",TAG);
}
@maluta
maluta / dalvik.sh
Created October 5, 2011 13:12
Command line Java on DalvikVM
#!/bin/sh
DIR="tmp_"$$
JAR=`echo $1 | tr '.' ' ' | awk '{ print $1 }'`
rm -rf $JAR.jar
mkdir $DIR
cp $1 $DIR
cd $DIR
echo "** Compiling java file..."
javac -d . -g $1
echo "** Creating temporary jar..."