Skip to content

Instantly share code, notes, and snippets.

@jbruchanov
jbruchanov / sheet_scipt.js
Last active November 13, 2022 19:09
GoogleNestInSheetHistory
/*
Create google sheet file with 'Data', 'Weather', 'Settings' sheets
Settings: //https://developers.google.com/nest/device-access/get-started
SDMUrl https://smartdevicemanagement.googleapis.com/v1
projectId ...
nestDeviceId ...
oauthClientId ...
oauthClientSecret ...
oauthRefreshToken ...
oauthAccessToken ...
@jbruchanov
jbruchanov / commit-hooks-windows-guide.txt
Last active July 22, 2022 12:38
Windows git prepare-commit-msg hook starting python script
//be sure your hook folder is correct
//`git config core.hooksPath`
//or set it `git config core.hooksPath .git/hooks`
//be sure the sh.exe exists and it's correct
//file:prepare-commit-msg
#!C:/Program\ Files/Git/usr/bin/sh.exe
python ".git/hooks/prepare-commit-msg.py" "$1"
exit 0
@jbruchanov
jbruchanov / appbackup.gradle
Created March 7, 2022 11:43
Very naive debug backup of android app
import java.text.SimpleDateFormat
/*
this is very !naive! implementation by making just a copy of defined files (probably doesn't handle spaces or special chars!)
1) define following `backupMap` and `removeBeforeRestore`
2) import it into the app build.gradle using `apply from: "$rootProject.projectDir/appbackup.gradle"`
3) and then just run:
#backup (see the BackupID e.g. 20220307-113423)
./gradlew app:appBackup
#restore
@jbruchanov
jbruchanov / fft.kt
Last active February 8, 2022 10:39
FFT - Kotlin
@file:Suppress("LocalVariableName")
package com.scurab.neonimpl
import kotlin.math.ceil
import kotlin.math.cos
import kotlin.math.sin
/*
Implementation of https://rosettacode.org/wiki/Fast_Fourier_transform#C
@jbruchanov
jbruchanov / fft.c
Created February 8, 2022 10:23
FFT-C
#include <stdio.h>
#include <math.h>
#include <time.h>
//algorithm taken from
//https://rosettacode.org/wiki/Fast_Fourier_transform#C
//simplified version to remove double complex numbers dependency to see exactly what the code does
//(N log(N)) - complexity
typedef float fftn;
?
https://stackoverflow.com/questions/12334468/java-sign-certificate-programmatically-without-bc
https://www.programmersought.com/article/50962351573/
https://github.com/apache/commons-crypto
https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
#Private CA key
openssl genrsa -des3 -out myCA.key 2048
#Public CA certificate
@jbruchanov
jbruchanov / event.ics
Created April 6, 2021 09:11
GCalendar, last working day of month
#google calendar -> settings -> import
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1;WKST=MO
SUMMARY:Invoicing
DTSTART;VALUE=DATE:20210430
SEQUENCE:0
DESCRIPTION:Invoicing.
END:VEVENT
private static def isAndroidApp(Project project) {
return project.plugins.findPlugin("com.android.application") != null
}
private static def isJavaLib(Project project) {
return project.plugins.findPlugin("java-library") != null
}
class ProjectDetails {
ProjectDetails(classDirs, srcDirs, buildDir, testTask) {
@jbruchanov
jbruchanov / Analytics.kt
Last active January 12, 2020 20:38
Analytics uFramework
package com.kotlin
interface IEventName {
val eventName: String
}
interface IAnalyticsArgsEvent<T> : IEventName
interface IAnalyticsMapArgsEvent : IAnalyticsArgsEvent<Map<String, Any>>
class AnalyticsArgsEvent<T>(override val eventName: String) : IAnalyticsArgsEvent<T>
class AnalyticsMapArgsEvent(override val eventName: String) : IAnalyticsMapArgsEvent
@jbruchanov
jbruchanov / AppDelegate.m
Created January 3, 2020 21:49
UITor - macos
//
// AppDelegate.m
// uitor
//
// Created by Jiri Bruchanov on 03/01/2020.
// Copyright © 2020 Jiri Bruchanov. All rights reserved.
//
//WEB Server https://github.com/swisspol/GCDWebServer