Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/drupal/includes/common.inc).

Using rtmpdump to get video from rtp play archive

rtmpdump -v -r "rtmp://h2k.rtp.pt/fastplay" -y "mp4:nas2.share/h264/512x384/palegria/praca_3_20121227.mp4" -o file.mp4

How to list Android services running by package name

adb shell dumpsys activity services net.package

Counting mumber of methods on jars found in a directory

Very very very helpful when the apk reach the max of 64K method limit. "java.lang.IllegalArgumentException: Dex method index overflow [65643]"


totalmethods=0
for jar in `find . -type f -name "*.jar"`; do
echo $jar
dx --dex --output=temp.dex $jar 2> /dev/null
jarmethods=$(cat temp.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"')
echo $jarmethods
totalmethods=$(($a+$totalmethods))
echo $totalmethods
done

Here is a list of libraries that worth mentioning:

Facebook Album Photo Viewer in autoplay mode!

This might be helpful for someone that want facebook to show album photos in continuous mode!


var secondsDelay =2000;
var elem = document.getElementsByClassName("snowliftPager next hilightPager")[0];
setInterval(function() {
elem.click();
},secondsDelay);

Downloading first google image result

How to download an image from google:

def getimageurlfromgoogle(query)
response = Net::HTTP.get_response('ajax.googleapis.com',
URI.encode("/ajax/services/search/images?v=1.0&q=#{query}&as_filetype=png&safe=active"))
JSON.parse(response.body)["responseData"]["results"][0]["url"]
end

The first result is not always the best result!!

SSH Tunneling for the win

This is extremely useful when there is a machine inside a network which can't have open ports. By using ssh remote port forwarding, it's possible to access that machine using another machine that can have open ports for everyone.

SSH Snippet: autossh -M 0 -N -f -R REMOTESERVER_ACCESSIBLE_BY_EVERYONE:8080:LOCAL_SERVER_NOT_ACCESSIBLE:8080 user@REMOTESERVER_ACCESSIBLE_BY_EVERYONE

Tcpdump & Wireshark with Android

Some necessary commands and files to use tcpdump and wireshark with any Android device with root. The necessary files can be download from here: http://www.strazzere.com/android/tcpdump

mount -o remount,rw /system
cp /sdcard/data/tcpdump system/bin
chmod 777 tcpdump
mount -o remount,ro /system

Downloading apks from google play store

This is really helpful!! Sometimes I need to test an app that is not available in my country or it is not available to install on my device because of tue requirements but I want to install it anyway, then this is just what I need:
http://apps.evozi.com/apk-downloader/

Install 3rd party apps as system apps

Here is the very useful command to install a common app as system app. It's not necessary to say that's mandatory that the device needs to be rooted!

Explanation:
#remount system partition with read and write capabilities
#move the app from the sdcard to the /system/app directory
#remount again as read only
#reboot the device

How to pass extra values to activity from shell

This command is very useful when you need to start an activity from shell environment that needs to receive args (extras in the intent).

Cmd:
adb shell am start -e extraName extraValue -n packageName/.activityName {activity flags}

Example:
adb shell am start -e Language PT -n pt.fraunhofer.util.changelanguage/.ActivityChangeLanguage --activity-clear-top

Pages

Subscribe to drjunior.net RSS