Skip to content

Instantly share code, notes, and snippets.

@stevecheckoway
stevecheckoway / skramdown.rb
Last active October 24, 2018 21:29
Simple Jekyll plugin to 1. parse `$…$` or `\(…\)` as inline math; 2. parse `$$…$$` as display math both inside and outside paragraphs.
# This is a (more) sane math parsing scheme.
require 'kramdown/parser/kramdown'
require 'kramdown/parser/kramdown/block_boundary'
module Kramdown
module Parser
class Skramdown < Kramdown::Parser::GFM
def initialize(source, options)
super
idx = @span_parsers.index(:inline_math)
@mbinna
mbinna / effective_modern_cmake.md
Last active May 19, 2025 13:07
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

Network

We need a global docker network in order to communicate between docker-compose setups on different hosts

Step 1: Install and run Consul (as a key-value storage for docker)

https://www.consul.io/intro/getting-started/install.html

Step 2: Edit docker configuration (on each docker host)

@Quar
Quar / stream_tar.bash
Last active October 20, 2017 22:57
common tools
# view contents inside tar.gz
curl -s https://www.x.org/releases/individual/util/util-macros-1.19.1.tar.gz | tar -tf -
# view file inside tar.gz
curl -s https://www.x.org/releases/individual/util/util-macros-1.19.1.tar.gz | tar --strip-components 1 -xOf - util-macros-1.19.1/README
# search file using glob-pattern tcsh(1)
curl -s https://www.x.org/releases/individual/util/util-macros-1.19.1.tar.gz | tar --strip-components 1 -xOf - '**/README'
@simoncos
simoncos / golang_on_rpi.md
Last active March 7, 2025 06:21 — forked from konradko/golang_on_rpi.md
Install Golang 1.9 on Raspberry Pi

Install Golang 1.9:

wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile

If already installed old golang with apt-get:

@datacustodian
datacustodian / Document_Conversion.md
Last active December 7, 2023 15:22
Document Conversion

Document Conversion

This document outlines some ideas for document conversion on Linux and Mac OS X platforms using command line tools. Distribute documents as plain text using UTF-8 encoding whenever possible. Everyone should embrace the mantra "plain text is beautiful".

Document Metadata

Use file command to obtain basic metadata for most file formats. For image files make sure you have ImageMagick installed, then use identify command to extract image metadata.

Encoding Conversion

@YohanObadia
YohanObadia / knn_impute.py
Last active January 25, 2024 14:23
Imputation of missing values with knn.
import numpy as np
import pandas as pd
from collections import defaultdict
from scipy.stats import hmean
from scipy.spatial.distance import cdist
from scipy import stats
import numbers
def weighted_hamming(data):
@GabLeRoux
GabLeRoux / problem.log
Last active March 25, 2018 23:27
VirtualBox is configured with multiple host-only adapters with the same IP "192.168.99.1"
Docker Machine Version: 0.7.0, build HEAD
Found binary path at /usr/bin/docker-machine
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:43433
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
command=start machine=default
Starting "default"...
@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active May 3, 2025 19:21
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

@Cr4sh
Cr4sh / fork.c
Created March 19, 2016 15:08
fork() for Windows
/*
* fork.c
* Experimental fork() on Windows. Requires NT 6 subsystem or
* newer.
*
* Copyright (c) 2012 William Pitcock <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.