Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# fill these values in
PACKAGE=package
DB=db.db
# copy db to sdcard using package permission (using cat because no cp command)
adb shell "run-as $PACKAGE cat /data/data/$PACKAGE/databases/$DB > /sdcard/$DB"
# pull file from sd card
@cdsap
cdsap / AndroidManifest.xml
Last active January 7, 2021 17:59
Example ManifestPlaceHolder
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
@cdsap
cdsap / gist:f78fcebd9679a035c618
Created November 25, 2014 08:29
applicationIdSuffix
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 21
@cdsap
cdsap / customers.json
Created August 23, 2015 15:35
TestIntercom
[{"latitude": "52.986375", "user_id": 12, "name": "Christina McArdle", "longitude": "-6.043701"},
{"latitude": "51.92893", "user_id": 1, "name": "Alice Cahill", "longitude": "-10.27699"},
{"latitude": "51.8856167", "user_id": 2, "name": "Ian McArdle", "longitude": "-10.4240951"},
{"latitude": "52.3191841", "user_id": 3, "name": "Jack Enright", "longitude": "-8.5072391"},
{"latitude": "53.807778", "user_id": 28, "name": "Charlie Halligan", "longitude": "-7.714444"},
{"latitude": "53.4692815", "user_id": 7, "name": "Frank Kehoe", "longitude": "-9.436036"},
{"latitude": "54.0894797", "user_id": 8, "name": "Eoin Ahearn", "longitude": "-6.18671"},
{"latitude": "53.038056", "user_id": 26, "name": "Stephen McArdle", "longitude": "-7.653889"},
{"latitude": "54.1225", "user_id": 27, "name": "Enid Gallagher", "longitude": "-8.143333"},
{"latitude": "53.1229599", "user_id": 6, "name": "Theresa Enright", "longitude": "-6.2705202"},
@cdsap
cdsap / build.gradle
Created November 22, 2015 18:14
Simple build gradle config
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.inaki.myapplication"
minSdkVersion 15
targetSdkVersion 23
@cdsap
cdsap / CLA.md
Last active October 9, 2017 04:55
CLA

Agoda Logo

INDIVIDUAL CONTRIBUTOR LICENSE AGREEMENT

Thank you for your interest in Agoda.com (the "Company") open source project. The Company asks you (“You” or “Contributor”) to sign this Contribution License Agreement in order to protect you as a Contributor and the Company and its users. This is not an assignment and it does not affect your ownership of your Contributions for any other purpose. It does, however, grant to the Company certain rights to your Contributions.

Please complete, sign and return this Agreement to the Company below by using GitHub

Please read this document carefully before signing and keep a copy for your records.

@cdsap
cdsap / web.xml
Created April 16, 2018 09:13
WEB-INF/web.xml Hello World
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>com.droidcon.server.HelloWorldService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
@cdsap
cdsap / HelloWorldService.kt
Created April 16, 2018 09:15
HelloWorldService::doGet HelloWorld
override fun doGet(req: HttpServletRequest?, resp: HttpServletResponse?) {
resp?.apply {
contentType = "text/plain"
writer.println("Hello World")
}
}
@cdsap
cdsap / build.gradle
Created April 16, 2018 10:46
build.gradle Server
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
dependencies {
implementation libraries.endpoints
providedCompile libraries.javax_servlet
implementation libraries.kotlin
implementation libraries.javax_inject
@cdsap
cdsap / synctradesimpl.kt
Created April 16, 2018 10:47
SyncTrades Server
class SyncTradesImpl @Inject constructor(private val localRepository: GetTradesRepository,
private val remoteRepository: GetTradesRepository) : SyncTrades {
override fun syncTrades(id: Long) {
remoteRepository.getTrades(id).trades
.map { TradeStore(it.trade_id, it.rate, it.amount, it.trade_date, it.trade_type) }
.map { localRepository.save(it) }
}
}