Skip to content

Instantly share code, notes, and snippets.

View Sloy's full-sized avatar

Rafa Vázquez Sloy

View GitHub Profile
@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jhansche
jhansche / watch-fds.sh
Created October 28, 2016 20:39
Simple script to monitor the number open file descriptors for an Android application.
#!/bin/sh
# Usage: ./watch-fds.sh <application_id> [delay_secs = 5]
APP_ID=${1:?missing application id}
DELAY=$(( ${2:-5} ))
DEVICE_LIMIT=$(( $(adb shell ulimit -n) ))
WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 ))
echo "Will warn at ${WARN_THRESHOLD}"
@cyrilmottier
cyrilmottier / CityBikesContract.java
Last active January 12, 2024 18:04
Using the new Gradle-based Android build system: a second example
package com.cyrilmottier.android.citybikes.provider;
import android.net.Uri;
import com.cyrilmottier.android.avelov.BuildConfig;
/**
* @author Cyril Mottier
*/
public class CityBikesContract {
@ravasthi
ravasthi / _config.yml
Created February 15, 2012 08:59
Multiple authors on Jekyll
authors:
hanzou:
name: Hanzou Hattori
display_name: Hanzou
gravatar: c66919cb194f96c696c1da0c47354a6a
email: hanzou@company.com
web: http://company.com
twitter: company
github: hhattori
jorgen:
@hvisser
hvisser / DemoModeEnabler.kt
Created January 23, 2018 11:44
Enables demo mode on a device for the purpose of taking screenshots
class DemoModeEnabler {
fun enable() {
executeShellCommand("settings put global sysui_demo_allowed 1")
sendCommand("exit")
sendCommand("enter")
sendCommand("notifications", "visible" to "false")
sendCommand("network", "wifi" to "hide")
sendCommand("battery", "level" to "100", "plugged" to "false")
sendCommand("clock", "hhmm" to "1000")
@shunchu
shunchu / video-thumbnails-generator.sh
Created November 15, 2012 18:00
Batch generate thumbnails from mp4 files using ffmpg
#!/bin/bash
# setup
FILES=name_of_file_to_match_*.mp4
SEEK_POINT=00:00:30
IMG_FORMAT=png
FRAME_SIZE=150X100
DEST=thumbnails
for f in $FILES
@rocboronat
rocboronat / PermissionGranter.java
Last active December 26, 2022 07:05
Tap the "allow" button while running an Android instrumental test using UIAutomator
package com.fewlaps.android.permissiongranter;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
import android.support.v4.content.ContextCompat;
@nicjansma
nicjansma / MountVHD.cmd
Created January 5, 2012 02:28
MountVHD and UnMountVHD: Allows you to mount .VHDs in Windows 7 from the command-line. http://nicj.net/2012/01/04/mounting-vhds-in-windows-7-from-a-command-line-script
@echo off
setlocal enabledelayedexpansion
if {%1}=={} (
echo Usage: %~nx0 [vhd] [letter]
exit /b 1
)
set vhdPath=%~dpnx1
set driveLetter=%2
@alexismp
alexismp / index.js
Last active November 8, 2022 21:58
Node.js 8 Cloud Function to write to a Google Sheets document
// Copyright 2018 Google LLC.
// SPDX-License-Identifier: Apache-2.0
const { google } = require("googleapis");
const { Storage } = require("@google-cloud/storage");
exports.csv2sheet = async (data, context) => {
var fileName = data.name;
// basic check that this is a *.csv file, etc...
if (!fileName.endsWith(".csv")) {
@jamsinclair
jamsinclair / shrug.md
Last active July 19, 2022 06:34
Markdown Escaped Shrug

¯\_(ツ)_/¯