Skip to content

Instantly share code, notes, and snippets.

View chernjie's full-sized avatar

CJ (curl | jq) chernjie

View GitHub Profile
#!/usr/bin/python
from __future__ import print_function
import argparse
import itertools
import sys
import yaml
script_template = """
@bittner
bittner / gnu-tools-for-mac.sh
Last active December 11, 2021 20:05
Cross-OS compatibility with GNU tools (readlink, sed, zcat, zless, zdiff, ...) for Mac OS X towards Linux
# DESCRIPTION OF PROBLEM: Implementations of sed, readlink, zcat, etc. are different on OS X and Linux.
# NOTE: Put this on top of your script using sed, readlink, zcat, etc. that should work alike on Mac OS X.
# cross-OS compatibility (greadlink, gsed, zcat are GNU implementations for OS X)
[[ `uname` == 'Darwin' ]] && {
which greadlink gsed gzcat > /dev/null && {
unalias readlink sed zcat
alias readlink=greadlink sed=gsed zcat=gzcat
} || {
echo 'ERROR: GNU utils required for Mac. You may use homebrew to install them: brew install coreutils gnu-sed'
@joshuajabbour
joshuajabbour / GitHub Wiki Subtree Storage.markdown
Created January 22, 2014 23:10
Store and edit GitHub wikis within the main project repository.

Project documentation

The project documentation (stored in the docs directory) is a git subtree of the project wiki. This allows for the documentation to be referenced and edited from within the main project.

Initial local setup

When cloning the main project repository for the first time, the wiki repository must be added as a remote.

git remote add wiki https://github.com//.wiki.git

@hyperair
hyperair / suniq.cpp
Last active December 16, 2015 20:09 — forked from alisaifee/suniq.cpp
Rewritten sort | uniq -c | sort -n[r] that works faster than the original.
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <unordered_map>
#include <map>
#include <iterator>
template <typename Iter>
void print (Iter i, Iter end)
@alisaifee
alisaifee / suniq.cpp
Created June 24, 2012 13:09
faster version of sort | uniq -c | sort -n[r]
#include <unordered_map>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <map>
#include <list>
#include <iterator>
#include <unistd.h>
#include <stdio.h>