Skip to content

Instantly share code, notes, and snippets.

@turingbirds
turingbirds / moore_penrose_pseudoinverse.c
Last active March 24, 2024 10:33
Compute the (Moore-Penrose) pseudo-inverse of a libgsl matrix in plain C.
/**
* Compute the (Moore-Penrose) pseudo-inverse of a libgsl matrix in plain C.
*
* Compile uding:
*
* gcc moore_penrose_pseudoinverse.c -lgsl -lblas
*
* Dependencies:
* - libgsl (GNU Scientific Library)
* - libblas (Basic Linear Algebra Subprograms)
@turingbirds
turingbirds / GNUPG Cheatsheet.md
Last active March 6, 2024 16:27
GPG (GNUPG) Cheatsheet

GNUPG CHEATSHEET

Setting up: key generation

This generates a public/private keypair.

$ gpg --gen-key

$ gpg --list-secret-keys

@turingbirds
turingbirds / invoke.py
Last active August 29, 2015 14:16
Execute a child program in a new process
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Execute a child program in a new process"""
import os
import subprocess
def exec_binary(cmd_line_list, cwd=None, stdout=None, stderr=None, verbose=False):
"""Invoke an executable file.
@turingbirds
turingbirds / usbreset.rst
Created October 31, 2014 20:30
usbreset.c
@turingbirds
turingbirds / upload.php
Last active May 30, 2019 13:40
a simple php upload script
<?php
header("Content-Type: text/html; charset=utf-8");
function display_filesize($filesize) {
if (is_numeric($filesize)) {
$decr = 1024;
$step = 0;
$prefix = array('Byte','KB','MB','GB','TB','PB');
@turingbirds
turingbirds / Git cheatsheet.markdown
Last active January 10, 2023 22:10
Git cheatsheet

Git cheatsheet

Set up Git

git config --global user.email "john_doe@example.com"
git config --global user.name "John Doe"