This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import json | |
import re | |
import shutil | |
from io import StringIO | |
from pathlib import Path | |
from typing import Callable, Optional, Sequence, Tuple, Union, cast | |
from git.diff import Diff, DiffIndex | |
from git.objects.commit import Commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct LinkedList<T> { | |
... | |
marker: PhantomData<Box<T>>, | |
} | |
impl<T> LinkedList<T> { | |
/* other list methods go before */ | |
/// Provides a cursor with immutable references to elements in the list. | |
/// The cursor starts ether with an empty element before the head or after the tail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double[] data1 = new double[100000]; | |
for (int i = 0; i < data1.length; i++) { | |
data1[i] = WaveGenerator.sawtoothWave((double) i / samplesPerSecond, 440); | |
} | |
playSong(data1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Python.h> | |
#include <stdio.h> | |
static PyObject * | |
trt_foo(PyObject *self, PyObject *args) { | |
printf("here!!!\n"); | |
return Py_None; | |
} | |
static PyMethodDef TrtMethods[] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flatmap: (a, b, c, (d, (e), f), g) -> (fn[a], fn[b], fn[c], fn[d], fn[e], fn[f], fn[g]) | |
map: (a, b, c, (d, (e), f), g) -> (fn[a], fn[b], fn[c], fn[(d, (e), f)], fn[g]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int array0[100]; // global memory | |
int main() { | |
int array1[100]; // function stack | |
int * ptr0 = array1; // points to stack | |
int * ptr1 = &array1[0]; // ptr0 == ptr1 | |
int * const ptr2 = alloca(sizeof(int) * 100); // points to stack!, almost the same as array1 | |
int * ptr3 = malloc(sizeof(int) * 100); // points to heap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void swapptr(int ** a, int **b) { | |
int * c = *a; | |
*a = *b; | |
*b = c; | |
} | |
int main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
int a; | |
void setA(int v) { | |
a = v; | |
} | |
}; | |
Foo a = new Foo(); | |
a->setA(123); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int vector_getmaxindex(vector_t * v, double z) { | |
int k; | |
if (z >= v->data[0]) { | |
for (k = 0; k < v->length; k++) { | |
if (v->data[k + 1] >= z) { | |
return k; | |
} | |
} | |
} | |
return -1; |