Skip to content

Instantly share code, notes, and snippets.

View anhnguyen1618's full-sized avatar

Ha Anh Nguyen anhnguyen1618

  • Helsinki, Finland
View GitHub Profile
enum Color: Int {
case green
}
struct Test {
static func f<A>(_ z: A) {
print("Not enum")
}
static func f<A>(_ z: A) where A == Color {
terraform {
required_providers {
google = {
source = "hashicorp/google"
}
}
}
variable "instance_name_input" {
type = string
}
new_img = np.zeros(img.shape)
new_img[:, :, 0] = conv1(img[:, :, 0], kernel, mode='reflect')
new_img[:, :, 1] = conv1(img[:, :, 1], kernel, mode='reflect')
new_img[:, :, 2] = conv1(img[:, :, 2], kernel, mode='reflect')
new_img[:, :, 0] = conv1(new_img[:, :, 0], kernel, mode='reflect', axis=0)
new_img[:, :, 1] = conv1(new_img[:, :, 1], kernel, mode='reflect', axis=0)
new_img[:, :, 2] = conv1(new_img[:, :, 2], kernel, mode='reflect', axis=0)
------------Test int 100------------
[Benchmark] Time elapsed: 1913 ns
[Benchmark] Time elapsed: 1570 ns
[Benchmark] Time elapsed: 1551 ns
[Benchmark] Time elapsed: 1550 ns
[Benchmark] Time elapsed: 1569 ns
[Benchmark] Time elapsed: 996 ns
[Benchmark] Time elapsed: 975 ns
[Benchmark] Time elapsed: 1005 ns
[Benchmark] Time elapsed: 1220 ns
------------Test int 100------------
[Benchmark] Time elapsed: 65849 ns
[Benchmark] Time elapsed: 65198 ns
[Benchmark] Time elapsed: 67855 ns
[Benchmark] Time elapsed: 65944 ns
[Benchmark] Time elapsed: 65239 ns
[Benchmark] Time elapsed: 66015 ns
[Benchmark] Time elapsed: 64729 ns
[Benchmark] Time elapsed: 64366 ns
[Benchmark] Time elapsed: 64205 ns
int[] vectorCPP = {1, 2, 3, 4, ...};
ArrayList<Integer> arrayListJava = new ArrayList<Integer>(length_of_vectorCPP);
for (int i: vectorCPP) {
Integer intObject = new Integer(i);
arrayListJava.Add(intObject);
}
return (List<Integer>) arrayListJava;
#include <chrono>
#include <codecvt>
#include <iostream>
#include <locale>
#include <memory>
#include <stdexcept>
#include <string>
static std::string dummy;
test
759 # 0 "" 2
760 .LVL99:
761 #NO_APP
762 .LBB536:
763 .LBB537:
764 .loc 4 201 0
765 vminss %xmm1, %xmm0, %xmm1
766 .LVL100:
767 .LBE537:
111 # rem
112 # 0 "" 2
113 .LVL8:
114 .loc 1 18 0 discriminator 2
115 # 18 "main.cc" 1
116 # foo
117 # 0 "" 2
118 .LVL9:
119 #NO_APP
120 movq %rax, %rcx
function count(numOfVars, evaluate) {
const num = Math.pow(2, numOfVars);
let counter = 0;
for (let i = 0; i < num; i++) {
const evals = [];
for (let j = 0; j < numOfVars; j++) {
evals.push((i >> j) & 1);
}