Skip to content

Instantly share code, notes, and snippets.

View ktchernov's full-sized avatar

Konstantin Tchernov ktchernov

View GitHub Profile
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<time.h>
#include "mpi.h"
#define PI 3.1415926535897931
#define OBSTYP 0
#define OBSM 1
#define dist2(x,x1,y,y1,z,z1) ((((x)-(x1))*((x)-(x1)))+(((y)-(y1))*((y)-(y1)))+(((z)-(z1))*((z)-(z1))))
package com.example.mydemoapp;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
import java.io.IOException;
package com.example.mydemoapp;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.concurrent.TimeUnit;
package io.github.ktchernov.moshiautovaluebug;
import com.squareup.moshi.Moshi;
import org.junit.Before;
import org.junit.Test;
import io.github.ktchernov.moshiautovaluebug.TestClassA.TestClassB;
import static org.junit.Assert.assertEquals;
package com.example.mydemoapp;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.Request;
package com.example.mydemoapp;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.SocketPolicy;

This is based on https://gist.github.com/rbuussyghin/0d7473a2692bdf6e0ef7

The change in my Gist is to add bash --login in front

Also note that the file launcher/bin/TeamCityAgentService-macosx-universal-32 may not be executable by default. You can add chmod +x run on that file to make it executable.

@ktchernov
ktchernov / StateAwareAppBarLayout.java
Created June 13, 2017 01:08
An extension of Android AppBarLayout, that allows to receive state changes (collapsed, expanded and idle). This is a simplified version of ControllableAppBarLayout (https://gist.github.com/skimarxall/863585dcd7abde8f4153) - only implementing a state change listener.
package io.github.ktchernov.play_aroundapp.views;
/**
* Copyright 2017 Konstantin Tchernov
*
* Adapted from: ControllableAppBarLayout by Bartosz Lipinski and
* Marcel Pintó Biescas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ktchernov
ktchernov / jdk.table.xml
Created June 20, 2017 05:26
Workaround for missing Android API level 26 sources in Android Studio 3 Canary (not yet made available to download by Google). Substitutes API 25 sources.
<!-- 0. Make sure you've got API level 25 sources
1. Open ~/Library/Preferences/AndroidStudioPreview3.0/options/jdk.table.xml (macOS path)
2. Find "API 26 Platform" section
3. Replace the <sourcePath> XML node in this section with the following (again, macOS path) -->
<sourcePath>
<root type="composite">
<root type="simple" url="file://$USER_HOME$/Library/Android/sdk/sources/android-25" />
</root>
</sourcePath>
@ktchernov
ktchernov / delete_merged_branches.sh
Created August 21, 2017 21:45
Delete merged branches
#!/bin/sh
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d