Skip to content

Instantly share code, notes, and snippets.

@jeromerobert
jeromerobert / gist:1258842
Created October 3, 2011 10:27
OCE0.6 without patch
radius: 1
Prim Torus: 2700
Nurbs Torus: 3762
radius: 2
Prim Torus: 2100
Nurbs Torus: 2736
radius: 3
Prim Torus: 1800
Nurbs Torus: 2280
radius: 4
@jeromerobert
jeromerobert / gist:1258872
Created October 3, 2011 10:38
OCE 0.6 with patch
radius: 1
Prim Torus: 2700
Nurbs Torus: 2406
radius: 2
Prim Torus: 2100
Nurbs Torus: 1838
radius: 3
Prim Torus: 1800
Nurbs Torus: 1852
radius: 4
@jeromerobert
jeromerobert / pandoc-svg.py
Last active September 1, 2023 09:05
Pandoc filter to create PDF files from SVG
#! /usr/bin/env python
"""
Pandoc filter to convert svg files to pdf as suggested at:
https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
"""
__author__ = "Jerome Robert"
import mimetypes
import subprocess
@jeromerobert
jeromerobert / extract-data.py
Last active August 12, 2024 21:26
Extract embedded images from svg
#! /usr/bin/env python3
import xml.etree.ElementTree as ET
import sys
import base64
import os
PREFIX="data:image/png;base64,"
ATTR="{http://www.w3.org/1999/xlink}href"
DEFAULT_NS="http://www.w3.org/2000/svg"
with open(sys.argv[1]) as f:
@jeromerobert
jeromerobert / openblas-bug478.c
Last active August 29, 2015 14:12
OpenBLAS bug #478
// build with gcc -Ofast -g -lpthread -lblas -lrt openblas-bug478.c or
// gcc -Ofast -g -lpthread -lopenblas -lrt openblas-bug478.c
// run with OPENBLAS_NUM_THREADS=1
#include <stdlib.h>
#include <stdio.h>
#include <cblas.h>
#include <time.h>
#include <pthread.h>
// number of loop for a 1x1 matrix. Change it if the test is
From : 1000 To : 200000 Step = 2000 Inc_x = 1 Inc_y = 1 Loops = 10
SIZE Flops
1000 : 5000.00 MBytes
3000 : 3692.31 MBytes
5000 : 3478.26 MBytes
7000 : 3684.21 MBytes
9000 : 4675.32 MBytes
11000 : 4705.88 MBytes
13000 : 4663.68 MBytes
15000 : 4687.50 MBytes

https://github.com/wine-compholio/wine-staging/tree/master/patches/ntdll-NtQueryVirtualMemory

trace:file:K32GetMappedFileNameW (0xffffffff, 0x590000, 0x33fa78, 259)
trace:file:K32GetMappedFileNameW L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt"
trace:file:OpenFile \??\C:\users\jerome\Temp\wbxtra_04162017_085311.wbt OF_WRITE OF_SHARE_COMPAT 
trace:file:OpenFile \??\C:\users\jerome\Temp\wbxtra_04162017_085311.wbt 0001
trace:file:RtlGetFullPathName_U (L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt" 520 0x33f728 0x33f724)
trace:file:RtlDosPathNameToNtPathName_U (L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt",0x33f598,(nil),(nil))
trace:file:RtlGetFullPathName_U (L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt" 520 0x33f338 (nil))
/*
* Copyright (C) 2017 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@jeromerobert
jeromerobert / setname.cpp
Created March 24, 2020 18:00
OpenCASCADE: Set the name of a TopoDS_Shape in a .step file
#include <STEPControl_Writer.hxx>
#include <STEPConstruct.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferWriter.hxx>
#include <StepRepr_RepresentationItem.hxx>
#include <TCollection_HAsciiString.hxx>
/** Set the name of a TopoDS_Shape in a .step file */
void setName(STEPControl_Writer & writer, const TopoDS_Shape & shape, const char * name) {
auto fp = writer.WS()->TransferWriter()->FinderProcess();
@jeromerobert
jeromerobert / blackratio.py
Last active May 28, 2023 12:53
Add black border to match ratio using PIL/Pillow
#! /usr/bin/env python3
import argparse
import os
from PIL import Image, ImageOps
def add_border(image_path: str, desired_ratio: float, output_file: str) -> None:
img = Image.open(image_path)
width, height = img.size