- Draw a rectangle covering everything you want to copy
- Press Ctrl+A to select all objects
- Object > Clip > Set
- Only the parts that were covered will be left
- Select all objects you want to center
#ifndef __CPU_TIMER_H__ | |
#define __CPU_TIMER_H__ | |
#include <time.h> | |
struct CpuTimer { | |
struct timespec start; | |
struct timespec stop; | |
}; |
CFLAGS += -Wall -Wextra -g -std=gnu99 | |
all: server | |
clean: | |
rm -f server |
// Static | |
int arr[3][5] = {0}; | |
printf("%d\n", arr[2][4]); | |
// Dynamic noncontiguous | |
int i; | |
int **arr = (int **) malloc(sizeof(int*)*3); | |
for ( i = 0 ; i < 3 ; ++i ) | |
arr[i] = (int *) malloc(sizeof(int)*5); | |
arr[2][4] = 0; |
CC = gcc | |
NOTIFY += $(shell pkg-config --cflags --libs libnotify) | |
.PHONY: clean | |
battery_daemon: battery_daemon.c | |
$(CC) -o $@ $(NOTIFY) $(CFLAGS) $< | |
clean: | |
rm -rf battery_daemon |
""" | |
Example of interfacing numpy to pyroot. Additionally, the great package | |
root_numpy implements interfaces between various pyroot objects and numpy | |
through a cython extension module. | |
""" | |
import numpy as np | |
import ROOT | |
data = ROOT.TGraph("filename") | |
# Create buffers |
"""Updating timer that shows progress.""" | |
import time | |
i = 0 | |
while i < 1: | |
print("Completed: {:6.2%}".format(i), end='\r', flush=True) | |
i += 1/10000 # update by 1 permil | |
time.sleep(1/1000) # 1 ms | |
print() |
def flatten(iterable): | |
try: | |
if isinstance(iterable, (str, bytes)): # are recursively iterable | |
raise TypeError # could've just as well been yield iterable, then else is needed | |
for item in iterable: | |
yield from flatten(item) | |
## alternative (py2): | |
# for nested in flatten(item): | |
# yield nested | |
except TypeError: |
-module(ring). | |
-export([start/2, listen/1]). | |
%% listen to pings and forward to Pid | |
listen(Pid) -> | |
receive | |
ping -> | |
Pid ! ping, | |
listen(Pid) | |
end. |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.optimize import curve_fit | |
from scipy.stats import norm | |
a = np.array([[1, 3, 5], [2, 4, 6]]) | |
## keyword args can be in any order | |
xdata = np.array(a, order='F', dtype=np.float32, ndmin=3) # fortran data order | |
xdata.resize(6) | |
print xdata |