Skip to content

Instantly share code, notes, and snippets.

View lopesivan's full-sized avatar
🚧
Working from home

Mr. Ivan lopesivan

🚧
Working from home
View GitHub Profile
import sqlite3
import os
from itertools import cycle, product
DB_FILE = "data.sqlite3"
num_rows = 100000000
elements = cycle(product(["name1", "name2", "name3"], [1,2,3]))
conn = sqlite3.connect(DB_FILE)
curs = conn.cursor()
import sqlite3
import os
from itertools import cycle, product
DB_FILE = "data.sqlite3"
num_rows = 100000000
elements = cycle(product(["name1", "name2", "name3"], [1,2,3]))
conn = sqlite3.connect(DB_FILE)
curs = conn.cursor()
@lopesivan
lopesivan / supervisor
Created April 11, 2022 22:46 — forked from danielrmeyer/supervisor
supervisor config to keep a python script running in home directory.
[program:test]
command=/usr/bin/python /home/ubuntu/test.py
directory=/home/ubuntu
autostart=true
autorestart=true
startretries=3
stderr_logfile=/home/ubuntu/test.err.log
stdout_logfile=/home/ubuntu/test.out.log
user=ubuntu
@lopesivan
lopesivan / onemalloc.c
Created January 18, 2022 05:02
one malloc
#include <stdio.h>
#include <stdlib.h>
typedef unsigned char uint8_t;
#define data_fmt "%8f"
typedef double Scalar;
typedef Scalar* Array1d;
typedef Scalar** Array2d;
typedef Scalar*** Array3d;
@lopesivan
lopesivan / build.md
Created December 3, 2021 02:18
Compile ngspice

Compile ngspice

git clone git://git.code.sf.net/p/ngspice/ngspice
cd ngspice
./autogen.sh
mkdir release
cd release
../configure --with-x --enable-xspice --enable-cider --with-readline=yes --enable-openmp --disable-debug CFLAGS="-m64 -O2" LDFLAGS="-m64 -s"
@lopesivan
lopesivan / a.sh
Created April 13, 2021 22:49
find file ignored .git
find . -not -iwholename \'*.git*\' -type f
@lopesivan
lopesivan / terminal.sh
Last active November 27, 2020 05:14
copiando arquivos
find . -type f -name \*.txt |
sed -e 'h;s/^/cp /p' -e 'g' -e 's=/=_=g' -e 's/^\._//' -e 's/$/.tmpl/' |
paste - -"
@lopesivan
lopesivan / qdda.md
Last active May 10, 2022 03:40
quick and dirty dynamic array

Usage:

struct X
{
    int i;
};

int main()
@lopesivan
lopesivan / ccls.md
Created June 19, 2020 17:54
.ccls examples

.ccls examples Example A

clang
%c -std=c11
%cpp -std=c++2a
%h %hpp --include=Global.h
-Iinc
-DMACRO
@lopesivan
lopesivan / ansers.md
Last active May 14, 2020 02:57
How to check the version of GMP, MPFR and CamlIDL?

My question is simple... How could I check the version of GMP installed on my machine? What about MPFR? And What about CamlIDL?

Thank you very much

To check for GMP(MPIR) version, access string __gmp_version(__mpir_version) in dynamic library called libgmp.so.X.Y.Z(libmpir.so.X.Y.Z). Your standard library directory might contain more than one such file (this happens if you install newer version of GMP or MPIR but your package manager chooses to keep old version because it is still needed).

Cutting off a small Python code fragment from [benchmark_det_Dixon.py][1]:

import ctypes

so_name='/usr/lib/x86_64-linux-gnu/libgmp.so'