Skip to content

Instantly share code, notes, and snippets.

Avatar

Artur Mkrtchyan arturmkrtchyan

View GitHub Profile
View http2.java
import jdk.incubator.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create("http://www.google.com")).GET().build();
HttpResponse response = client.send(request, HttpResponse.BodyHandler.asString())
System.out.println(response.body())
@arturmkrtchyan
arturmkrtchyan / Intro.md
Last active Oct 13, 2016
Machine Learning Introduction
View Intro.md

Machine Learning Algorithm families

Supervised Learning (e.g. classification, anomaly detection, regression)

  • Input data is called training data and has a known label or result such as spam/not-spam or a stock price at a time.
  • A model is prepared through a training process where it is required to make predictions and is corrected when those predictions are wrong. The training process continues until the model achieves a desired level of accuracy on the training data.
  • Example problems are classification and regression.
  • Example algorithms include Logistic Regression and the Back Propagation Neural Network.

Unsupervised Learning (e.g. clustering and dimensionality reduction)

  • Input data is not labelled and does not have a known result.
@arturmkrtchyan
arturmkrtchyan / gist:c56f64e2a4f65cfebb2a
Created Oct 15, 2015 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
View gist:c56f64e2a4f65cfebb2a
  1. General Background and Overview
@arturmkrtchyan
arturmkrtchyan / get_job_status.sh
Last active Nov 24, 2020
Apache Spark Hidden REST API
View get_job_status.sh
curl http://spark-cluster-ip:6066/v1/submissions/status/driver-20151008145126-0000
@arturmkrtchyan
arturmkrtchyan / add_slaves.sh
Last active Aug 29, 2015
Hadoop Cluster Installation
View add_slaves.sh
10.64.200.48
10.64.200.49
10.64.200.50
10.64.200.51
View thread1.c
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
void *thread_function(void *arg) {
int i;
for ( i=0; i<20; i++ ) {
printf("Thread says hi!\n");
sleep(1);
}
View ObjectHeader32.txt
|----------------------------------------------------------------------------------------|--------------------|
| Object Header (64 bits) | State |
|-------------------------------------------------------|--------------------------------|--------------------|
| Mark Word (32 bits) | Klass Word (32 bits) | |
|-------------------------------------------------------|--------------------------------|--------------------|
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal |
|-------------------------------------------------------|--------------------------------|--------------------|
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased |
|-------------------------------------------------------|--------------------------------|--------------------|
|
@arturmkrtchyan
arturmkrtchyan / EnumSwitch.class
Last active Aug 29, 2015
JVM tableswitch vs lookupswitch
View EnumSwitch.class
private static void enumSwitch();
Code:
0: getstatic #2 // Field DayOfWeek.FRIDAY:LDayOfWeek;
3: astore_0
4: iconst_0
5: istore_1
6: getstatic #3 // Field Switch$1.$SwitchMap$DayOfWeek:[I
9: aload_0
10: invokevirtual #4 // Method DayOfWeek.ordinal:()I
13: iaload
@arturmkrtchyan
arturmkrtchyan / ObjectVsStruct.java
Created Jan 6, 2015
Java Off/On Heap Struct/Object Creation
View ObjectVsStruct.java
import sun.misc.Cleaner;
import sun.misc.Unsafe;
import sun.nio.ch.DirectBuffer;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
// How to run:
// struct: javac ObjectVsStruct.java && java ObjectVsStruct struct
// object: javac ObjectVsStruct.java && java ObjectVsStruct object
@arturmkrtchyan
arturmkrtchyan / BiasedLocking.java
Last active Aug 29, 2015
Uncontended Biased Locking
View BiasedLocking.java
public class BiasedLocking {
private static final int LOOP_COUNT = 10000000; // 10 million
public static void main(final String[] args) {
incrementCounter();
}
public static void incrementCounter() {
final long startTime = System.currentTimeMillis();
You can’t perform that action at this time.