Skip to content

Instantly share code, notes, and snippets.

View timoshenkoav's full-sized avatar

Alexandr Timoshenko timoshenkoav

View GitHub Profile
async function getMomentJs() {
const response = await fetch("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js");
const minifiedLibrary= await response.text();
eval(minifiedLibrary)
moment.updateLocale('en', {
week : {
dow : 0 // Monday is the first day of the week.
}
})
}
@timoshenkoav
timoshenkoav / str_occupancy_sensor.groovy
Created January 20, 2022 10:34
STR Occupancy Sensor
//@Grab(group='org.mnode.ical4j', module='ical4j', version='1.0.2' )
import java.text.SimpleDateFormat
//import net.fortuna.ical4j.data.CalendarBuilder;
//import net.fortuna.ical4j.model.*;
//import net.fortuna.ical4j.model.component.*;
//import net.fortuna.ical4j.model.property.*;
metadata {
definition (name: "STR Occupancy Sensor", namespace: "timoshenko", author: "Alexandr Timoshenko") {
capability "Refresh"
@Test
public void fixedpool() throws InterruptedException, ExecutionException {
final ExecutorService s = Executors.newFixedThreadPool(2);
final List<Callable<String>> k = new ArrayList<>();
for (int i = 0; i < 10; ++i) {
k.add(() -> {
Thread.sleep(1000);
return Thread.currentThread().getName();
});
}
static class Shared {
final Object lock = new Object();
static int mutable;
synchronized void synchronizedMethodPlus() {
mutable += 1;
}
synchronized void synchronizedMethodMinus() {
mutable -= 1;
@timoshenkoav
timoshenkoav / WeakReferenceSample.java
Last active March 2, 2021 18:32
WeekReferenceTest
public class WeakReferenceSample {
public WeakReferenceSample(Listener listenerWeakReference) {
this.listenerWeakReference = new WeakReference<>(listenerWeakReference);
}
interface Listener {
void onDone();
}
private final WeakReference<Listener> listenerWeakReference;
@timoshenkoav
timoshenkoav / auto_step1.js
Created March 26, 2020 08:58
Auto.ru step 1
try{
var script = document.createElement(\'SCRIPT\');
script.src = \'https://yastatic.net/jquery/3.1.0/jquery.min.js\';
script.type = \'text/javascript\';
window.Android.jsLog(\'AutoRu start loading Query\');
script.onload = function() {
window.Android.jsLog(\'Query loaded\');
setTimeout(function(){
window.Android.jsLog(\'Check gdpr\');
if ($(\'#confirm-button\').length != 0){
@timoshenkoav
timoshenkoav / index.html
Created September 5, 2017 14:15
ember rails index
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Server</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{content-for "head"}}
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2517)
at android.app.ActivityThread.access$800(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:372)
AdLoader.Builder adLoader = new AdLoader.Builder(this, "ca-app-pub-6616020268701194/7420579864")
.forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
@Override
public void onAppInstallAdLoaded(NativeAppInstallAd nativeAppInstallAd) {
Log.d(TAG, "onAppInstallAdLoaded");
tv.setText(tv.getText().toString()+"onAppInstallAdLoaded\n");
}
})
.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {

11-22 07:22:48.241 3515-3571/? D/WifiHW: 'SIGNAL_POLL' command timed out.

11-22 07:22:48.241 3515-3571/? E/WifiStateMachine: Connection lost, restart supplicant

11-22 07:22:48.541 2417-3487/? D/CommandListener: Clearing all IP addresses on wlan0