Skip to content

Instantly share code, notes, and snippets.

@jbruchanov
jbruchanov / fix.sh
Created November 12, 2019 13:12
Rename commit author
git filter-branch --env-filter '
WRONG_EMAIL="old@name.com"
NEW_NAME="NewName"
NEW_EMAIL="new@name.com"
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
package git
import java.io.File
/*
How to use it
- https://raw.githubusercontent.com/erikmd/git-scripts/master/bin/git-format-patch-follow save into your
`/usr/local/bin/git-format-patch-follow` (not .sh suffix) & make it executable
- take following code
- update `patchesFolder`, `libNetworkSource`, `target` accordingly to your case
apply plugin: 'maven-publish'
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
group = 'publishing'
}
publishing {
publications {
@jbruchanov
jbruchanov / gist:373be69b87c73650df46bad5c8356a57
Created February 7, 2019 11:58
QA android screen recording script
#!/bin/bash
hash adb &> /dev/null
if [ $? -eq 1 ]; then
echo "adb not found, please contact your favourite android dev for help"
exit 1
fi
if [ -z ${HOME} ]; then
echo "HOME env var not set, please contact your favourite android dev for help"
exit 1
@jbruchanov
jbruchanov / readme.txt
Created October 17, 2017 18:30
JIDEA quick JNI header generation
Here are the IntelliJ IDEA settings I use to generate the .h file: (This applies to IDEA version 12.1.6, probably similar in other versions)
File->Settings->External Tools
Click the + button for the "Edit Tool" dialog
The following are the form name/value pairs I used:
Name: javah
Group: Java
Description: Java Native Interface C Header and Stub File Generator
Options: Check All
Show in: Check All
@jbruchanov
jbruchanov / sample.html
Created October 17, 2017 13:31
Android HTML asset + fonts
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<STYLE TYPE="text/css">
<!--
@font-face {
font-family: "Gotham-medium";
src: url('file:///android_asset/fonts/Gotham-Medium.ttf');
}
@jbruchanov
jbruchanov / makro.vbs
Created September 23, 2017 09:09
XVLookup
Function XVLookup(value As Range, dataSet As Range, returnCol As Integer, Optional indexValue As Integer = 0) As Variant
Dim val As String
Dim found As Integer
val = value.Cells
For counter = 1 To dataSet.Rows.Count
Dim cellval As String
cellval = dataSet.Cells(counter, 1)
If cellval = val Then
task generateVClass << {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def sep = System.getProperty("file.separator")
def rFileTemplate = "%s/generated/source/r/%s/%s/R.java".replace("/", sep)
def rFile = new File(String.format(rFileTemplate, project.buildDir, output.dirName.replace("/", sep), variant.applicationId.replace(".", sep)))
if (!rFile.exists()) {//clean, error or variant which is not currently building
return
}
println("Parsing:" + rFile.absolutePath)
public static void main(String[] args) throws IOException {
String hostname = "api.github.com";
//run with random key, error says pin hashes
//or
/*
openssl s_client -connect api.github.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
output:
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 High Assurance Server CA
cmake_minimum_required(VERSION 3.6)
project(SampleProject)
#enable C++ 11
set(CMAKE_CXX_STANDARD 11)
#seems like include libgcc library (didn't work everytime)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
#header file location
include_directories("c:\\Temp\\header")