Skip to content

Instantly share code, notes, and snippets.

@jbruchanov
jbruchanov / upload.html
Created November 10, 2016 14:33
AJAX file uploading + progress
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Title</title>
</head>
<script type="application/javascript">
/* //PHP SERVER SIDE
<?php
@jbruchanov
jbruchanov / ArbiterTask
Last active January 3, 2017 23:00
ArbiterTask
package com.smallplanet.android.planned;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
/**
* Created by JBruchanov on 03/01/2017.
*/
public class ArbiterTask<T> extends AsyncTask<Void, Void, T> {
deleteConfig=false
params=("$@")
if [[ -z "${params[0]}" ]]; then
params=(-c "@MOUNT C /home/pi/RetroPie/roms/pc" -c "@C:")
elif [[ "${params[0]}" == *.sh ]]; then
bash "${params[@]}"
exit
else
file="${params[@]}"
folder=${file%/*}
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")
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
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)
@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
@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 / 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 / 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