Skip to content

Instantly share code, notes, and snippets.

(defun replace-newlines-with-spaces ()
"Replace all newlines in the current region with spaces."
(interactive)
(save-excursion
(let ((start (if (region-active-p) (region-beginning) (point-min)))
(end (if (region-active-p) (region-end) (point-max))))
(goto-char start)
(while (search-forward "\n" end t)
(replace-match " " nil t)))))
import numpy
import matplotlib.pyplot as plt
import cv2
from sys import argv
def autocorr1(x,lags):
'''numpy.corrcoef, partial'''
corr=[1. if l==0 else numpy.corrcoef(x[l:],x[:-l])[0][1] for l in lags]
return numpy.array(corr)
<style scoped>
#main {
display: grid;
grid-template-columns: 6fr;
grid-template-rows: 12fr;
gap: 12px;
}
#sketchfabmod { width: 50vw; height: 80vh; display: inline-block }
#sketchfabmat { width: 25vw; height: 80vh; display: inline-block }
<style scoped>
</style>
<template>
<div>empty component
<div v-for="m in ['ctrlKey', 'altKey', 'shiftKey']">{{ keyModifiers[m] }}</div>
</div>
</template>
<script>
module.exports = {
data: function () {
uniform sampler2D texture;
uniform vec2 texSize;
varying vec2 texCoord;
uniform float degrees;
const float PI = 3.1415926535897932384626433832795;
const vec2 HALF = vec2(0.5);
float deg2rad(float deg){ return deg * PI / 180.0; }
void main() {
vec2 coord = texCoord.xy;
#!/bin/bash
# from https://discuss.pixls.us/t/a-script-to-open-a-gimp-2-9-xcf-file-and-export-a-png/5443/2
{
cat <<EOF
(define (convert-xcf-to-jpeg filename outfile)
(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename )))
(drawable (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
)
(file-jpeg-save RUN-NONINTERACTIVE image drawable outfile outfile .9 0 0 0 " " 0 1 0 1)
import bpy
from mathutils import Vector, Matrix
from bpy_extras import view3d_utils
import bmesh
import numpy as np
import os, sys
import cv2
import bpy
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
def make_app():
from svgpathtools import parse_path, kinks
import numpy as np
# a bunch of paths - atually all quite similar
paths = [
'm 269.68858,24.762486 c -40.50864,-1.700513 -82.13567,24.752876 -90.53902,65.804462 -13.14294,37.392562 -17.2298,77.029262 -21.30965,116.163222 2.18009,35.53756 2.00517,72.32618 18.49409,105.0151 17.65672,49.88028 40.60061,89.34487 56.23634,137.55913 8.01979,33.12323 -0.64042,66.17131 0.0854,99.31004 -1.70152,58.80692 -18.69271,117.97032 -3.57251,176.35988 4.75221,41.18507 47.61108,68.96937 84.43863,69.35203 36.82756,0.38265 66.60039,-18.16206 77.87482,-50.2879 17.90406,-42.01272 17.79235,-81.49902 16.42076,-133.65857 -1.37159,-52.15955 6.43528,-134.61422 11.35889,-178.16317 4.9236,-43.54895 9.02792,-54.92485 8.65922,-82.92663 C 434.67597,283.85003 417.4602,218.83964 391.752,159.17256 381.13197,135.51373 372.07804,115.94824 355.87316,89.293903 339.66828,62.639564 309.19251,27.626442 269.68858,24.762486 Z',
'm 269.903,19.8186 c -11.91711,-0.51685 -32.27731,1.070319 -53.46034,13.3632

La documentazione di svgpathtools è qui - non è perfetta, ma credo ti serva solo sapere come si converte una curva a una polinomiale in numpy, che è annotata nel programma in python.

Un bel documento sulle curve di Bezier è qui, e la documentazione su <path> in SVG è qui

Le due domande che ti ho mandato sono qui e qui