Skip to content

Instantly share code, notes, and snippets.

@cattaka
cattaka / dumpheap
Last active October 28, 2017 04:43
Dump Android hprof and convert to hprof for Memory Analyzer
#!/bin/sh
if [ -z "$1" ]; then
echo "USAGE: dumphprof <package_name> [<out_file>]"
exit 1
fi
date=`date '+%Y%m%d%H%M%S'`
temp_file="$1_${date}_orig.hprof"
output_file="$1_${date}.hprof"
@heiko-r
heiko-r / ble_config.c
Created October 26, 2017 12:39
ESP32 BLE GATT server example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "esp_system.h"
#include "esp_log.h"
#include "bt.h"
#include "bta_api.h"
#include "esp_gap_ble_api.h"
#include "esp_bt_main.h"
def dump_values(obj)
results = ""
obj.keys.each do |key|
results += key.to_s + "\t" + obj[key].to_s + "\n"
end
results
end
def dump_tsv(rows)
keys = rows.map do |row|
@cattaka
cattaka / adb-screenshot.sh
Last active December 6, 2017 00:51 — forked from hkurokawa/adb-screenshot.sh
A shell script to take a screen shot of the android device, resize it and copy to clipboard
#! /bin/bash
## This script is for taking a screen shot of an Android device.
## If possible, it tries to resize the image file and then copy to the clipboard.
##
## The script passes unrecognized arguments to adb command, which means you can specify "-e" or "-d"
## to select which device to take a screenshot of.
if [ -z $(which adb) ]; then
echo "Error. adb must be installed and in PATH." 1>&2
@hkurokawa
hkurokawa / adb-screenshot.sh
Last active August 30, 2023 06:27
A shell script to take a screen shot of the android device, resize it and copy to clipboard
#! /bin/bash
## This script is for taking a screen shot of an Android device.
## If possible, it tries to resize the image file and then copy to the clipboard.
##
## Note the script generates screenshot_yyyyMMddHHmmss.png and screenshot_yyyyMMddHHmmss_s.png
## under /sdcard on the device (you can specify another location with '-t' option)
## and copies it to the current working directory.
##
## The script passes unrecognized arguments to adb command, which means you can specify "-e" or "-d"
@josh-burton
josh-burton / MergeRecyclerAdapter
Created August 26, 2014 20:38
A Merge Adapter for the RecyclerView. Based on CommonsWare cwac-merge and the MergedAdapter in the android sdk.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;