Skip to content

Instantly share code, notes, and snippets.

View ricrogz's full-sized avatar

Ricardo Rodriguez ricrogz

View GitHub Profile
@ricrogz
ricrogz / gist:b96efdd4acee90ea6eb37803dc3ed83e
Created September 27, 2021 02:13
Free pooled mem to OS
#include <malloc.h>
malloc_trim(0);
@ricrogz
ricrogz / gist:a5b8fd5c90b6b03cda9413dc8d6cb099
Created September 25, 2021 17:32
Python: run in subprocess
import concurrent
with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor:
w = executor.submit(myfunc).result()
@ricrogz
ricrogz / gist:15aef07479aac1b4b20eec60a6070fa1
Created April 8, 2021 21:42
Draw RDKit mols in jupyter notebook
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
IPythonConsole.ipython_useSVG=True
IPythonConsole.drawOptions.addStereoAnnotation = True
IPythonConsole.drawOptions.addAtomIndices = False
@ricrogz
ricrogz / .git_config
Last active June 14, 2020 20:59
Strip output of Jupyter notebooks on git add
[filter "strip_ipynb"]
clean = python3 strip_ipynb.py
@ricrogz
ricrogz / OpenSSL RSA encryption sample
Created October 27, 2019 05:19 — forked from superwills/OpenSSL RSA encryption sample
Base64 encoding and RSA encryption sample
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#include <openssl/pem.h>
// I'm not using BIO for base64 encoding/decoding. It is difficult to use.
// Using superwills' Nibble And A Half instead
@ricrogz
ricrogz / gist:f4ceb343a54c653c77642f675b8272f4
Created January 16, 2019 02:08
Command line speed test
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
@ricrogz
ricrogz / gist:7b1487fcd831d9685ef23099655e29ae
Created November 29, 2018 01:52
RockFM Spain direct player
http://rockfm.cope.stream.flumotion.com/cope/rockfm.mp3.m3u
@ricrogz
ricrogz / gist:b836ac1b036b9989d3c26a3d9c435501
Created October 24, 2017 16:06
CLion: show contents of data structure while debugging
Define watch as:
*(MyClass(*)[length])MyVariable
@ricrogz
ricrogz / _Very_big_int_in_cython.txt
Last active June 6, 2021 12:55
Use int128 (really LONG integers) in cython
Taken from https://stackoverflow.com/questions/27582001/how-to-use-128-bit-integers-in-cython
Basically, we make cython believe we will use 64 bit int to generate the .c file,
but by using a C header we will, in fact, define a 128 bit int (the definition
in the .h file does not match what we put into the pyx file).
Once Cython has generated the .c file, we can compile it with GCC without further trouble,
as GCC does support 128 bit ints
@ricrogz
ricrogz / Canon_MX410_Black_N_White_enabled.ppd
Last active October 14, 2017 23:14
Canon MX410 ppd file for CUPS
*PPD-Adobe: "4.3"
*% CUPS add-on PPD file for Canon Inkjet Printer Driver.
*% Copyright CANON INC. 2001-2011
*% All Rights Reserved.
*%
*% 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; version 2 of the License.
*%
*% This program is distributed in the hope that it will be useful,