Skip to content

Instantly share code, notes, and snippets.

@t-bltg
t-bltg / stacktrace.cxx
Created December 5, 2021 12:26 — forked from fmela/stacktrace.cxx
A C++ function that produces a stack backtrace with demangled function & method names.
/*
* Copyright (c) 2009-2017, Farooq Mela
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@t-bltg
t-bltg / OOP_F2003_Part_1.md
Created February 2, 2018 16:10 — forked from n-s-k/OOP_F2003_Part_1.md
Object-Oriented Programming in Fortran 2003 Part 1: Code Reusability
@t-bltg
t-bltg / OOP_F2003_Part_2.md
Created February 2, 2018 16:10 — forked from n-s-k/OOP_F2003_Part_2.md
Object-Oriented Programming in Fortran 2003 Part 2: Data Polymorphism

Object-Oriented Programming in Fortran 2003 Part 2: Data Polymorphism

Original article by Mark Leair, PGI Compiler Engineer

Note: This article was revised in March 2015 and again in January 2016 to bring it up-to-date with the production software release and to correct errors in the examples.

This is Part 2 of a series of articles:

@t-bltg
t-bltg / X264Encoder.cpp
Created November 17, 2017 15:37 — forked from roxlu/X264Encoder.cpp
X264 encoder example
#include <roxlu/core/Log.h>
#include <roxlu/core/Utils.h>
#include <video/X264Encoder.h>
X264Encoder::X264Encoder()
:in_width(0)
,in_height(0)
,in_pixel_format(AV_PIX_FMT_NONE)
,out_width(0)
,out_height(0)
@t-bltg
t-bltg / pca_animation.m
Created October 29, 2017 11:52 — forked from anonymous/pca_animation.m
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
@t-bltg
t-bltg / static_server.js
Created May 25, 2017 17:14 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
// stackoverflow.com/a/13635318
// gist.github.com/ryanflorence/701407
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
@t-bltg
t-bltg / cs.h
Created March 3, 2017 22:37 — forked from rmcgibbo/LICENSE
Parallel Sparse Matrix Dense Matrix Product in C/Cython/Python.
#ifndef _CS_H
#define _CS_H
#include <stdlib.h>
// #include <stdint.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stddef.h>
#ifdef MATLAB_MEX_FILE
#include "mex.h"
@t-bltg
t-bltg / kmeans.pyx
Last active February 22, 2017 17:36 — forked from dwf/kmeans.pyx
Parallelized k-means in Cython.
"""
Parallelized k-means module.
By David Warde-Farley, February 2012. Licensed under the 3-clause BSD.
FROM gist.github.com/dwf/2200359
"""
cimport cython
from cython.parallel import prange
import numpy as np
cimport numpy as np
@t-bltg
t-bltg / ocrpdf.sh
Created May 19, 2016 13:38 — forked from wcaleb/ocrpdf.sh
Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable
#!/bin/sh
# Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable.
# Hacked together using tips from these websites:
# http://www.jlaundry.com/2012/ocr-a-scanned-pdf-with-tesseract/
# http://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line
# Dependencies: pdftk, tesseract, imagemagick, enscript, ps2pdf
# Would be nice to use hocr2pdf instead so that the text lines up with the PDF image.
# http://www.exactcode.com/site/open_source/exactimage/hocr2pdf/
@t-bltg
t-bltg / Indentation Rules.tmPreferences
Last active December 10, 2015 19:32 — forked from albertxing/Indentation Rules.tmPreferences
LaTeX indentation rules for Sublime Text. See usage in comments below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Indentation Rules</string>
<key>scope</key>
<string>text.tex, sources.bib</string>
<key>settings</key>
<dict>