Skip to content

Instantly share code, notes, and snippets.

View halirutan's full-sized avatar

Patrick Scheibe halirutan

  • Neurophysics Dep. at Max Planck Institute for Human Cognitive and Brain Sciences
  • Leipzig, Germany
View GitHub Profile
l = [[1, 2, 3], [2, 3, 3], [1, 3, 3]]
def find_max(lis):
tmp = list()
for i in lis:
tmp.append(sum(i))
return lis[tmp.index(max(tmp))]
import string
board_dims = {"x": 3, "y": 4}
board = {}
for i in string.ascii_uppercase[:board_dims["x"]]:
for j in range(1, board_dims["y"] + 1):
board[i + str(j)] = " "
print(board)
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
[
{
"pitch": -0.00275278276189006,
"roll": 0.0015076132005304999,
"speed": 0.0,
"time": 0.0,
"x": -0.023359131607296746,
"y": -0.007570947447817389,
"yaw": 0.00893027461175061,
"z": -0.002685727323409992
from numba import float64, boolean, prange, guvectorize, njit, set_num_threads
import numpy as np
@guvectorize([(boolean[:], boolean[:], float64[:])], '(n),(n)->()', nopython=True)
def tanimoto(fp_1, fp_2, res):
bw_or = np.sum(np.bitwise_or(fp_1, fp_2))
if bw_or != 0.0:
res[0] = np.sum(np.bitwise_and(fp_1, fp_2)) / bw_or
else:
#include <stdlib.h>
/**
* Return an array of arrays of size *returnSize.
* The sizes of the arrays are returned as *returnColumnSizes array.
* Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
*/
int** threeSum(int* nums, int numsSize, int* returnSize, int** returnColumnSizes){
*returnSize = 1;
*returnColumnSizes = (int*) malloc(1* sizeof(int));
*returnColumnSizes[0] = 3;
#include <stdio.h>
struct ListNode
{
int val;
struct ListNode *next;
};
int getSize(struct ListNode *head)
// Flache Liste funktioniert
std::array<std::array<Vec3, 2>,3> test{
Vec3{1,1,1},
Vec3{2,1,1},
Vec3{1,2,1},
Vec3{2,2,1},
Vec3{1,3,1},
Vec3{2,3,1}
@halirutan
halirutan / CMakeLists.txt
Created May 30, 2020 23:24
Late Night Coding OpenGL Particles
cmake_minimum_required(VERSION 3.16)
project(LateNightCodingOpenGL)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
find_package(OpenGL REQUIRED)
find_package(glfw3 REQUIRED)
find_package(GLEW REQUIRED)
set(CMAKE_CXX_STANDARD 17)
#include <string>
#include "peglib.h"
using namespace peg;
using namespace std;
int main(void)
{ // (2) Make a parser
parser parser(R"(
# Grammar for Calculator...