Skip to content

Instantly share code, notes, and snippets.

View tonilopezmr's full-sized avatar

Antonio López Marín tonilopezmr

View GitHub Profile
@Serchinastico
Serchinastico / .gitconfig
Last active June 5, 2018 17:12
Alias for easier git rebase --onto
[alias]
# ronto stands for "rebase --onto". Uses the current branch to move it and updates the start-of-the-branch tag along
ronto = "!f() { \
git rebase --onto $1 __start__$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --abbrev-ref HEAD); \
git tag -d __start__$(git rev-parse --abbrev-ref HEAD); \
git tag __start__$(git rev-parse --abbrev-ref HEAD) $1; \
}; f"
# nb stands for "create branch". Creates a tag marking the start-of-the-branch
cb = "!f() { \
git tag __start__$1; \
@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;
@htp
htp / curl-websocket.sh
Last active April 25, 2024 14:57
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@lancevo
lancevo / FV.js
Created July 16, 2013 16:06
Calculate FV Same formula as Excel FV()
/*
Calculate FV.
Exact same Excel FV function
Rate is the interest rate per period.
Nper is the total number of payment periods in an annuity.
Pmt is the payment made each period; it cannot change over the life of the annuity. Pmt must be entered as a negative number.
Pv is the present value, or the lump-sum amount that a series of future payments is worth right now. If pv is omitted, it is assumed to be 0 (zero). PV must be entered as a negative number.
Type is the number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0 which represents at the end of the period. If payments are due at the beginning of the period, type should be 1.
*/