Skip to content

Instantly share code, notes, and snippets.

@junglie85
junglie85 / gitconfig
Created August 26, 2021 08:05
Git config
[user]
name = ...
email = ...
[core]
editor = vim
[color]
ui = true
@junglie85
junglie85 / cpp_filesystem_utility_examples.cpp
Created August 26, 2021 07:51
Basic C++ filesystem utility examples.
#include <filesystem>
#include <string>
namespace
{
std::string rootDirectory;
} // namespace
void triangle::fs::setRootDirectory(std::string appPath)
{
Package adder.clang_support is selected for /Library/Java/JavaVirtualMachines/jdk-14-panama-1-15.jdk/Contents/Home/conf/jextract
Package adder is selected for /Users/amb85/dev/adder
Parsing header file /Users/amb85/dev/adder/bindings.h with following args:
arg[0] = -I/Library/Developer/CommandLineTools/usr/include/c++/v1
arg[1] = -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
arg[2] = -I/Library/Java/JavaVirtualMachines/jdk-14-panama-1-15.jdk/Contents/Home/conf/jextract
arg[3] = -x
arg[4] = c++
Do cursor: __llvm__@c:@macro@__llvm__
@junglie85
junglie85 / pipenv-python-pre-commit-hook
Created September 24, 2019 07:25
Basic git pre-commit hook with Pipenv
#!/bin/sh
set -eo pipefail
RELATIVE_HOOKS_DIR=${BASH_SOURCE%/*}
if [[ -f ${RELATIVE_HOOKS_DIR}/../.git/hooks/pre-commit ]]; then
./${RELATIVE_HOOKS_DIR}/../.git/hooks/pre-commit
fi
PIPENV_PIPFILE=${RELATIVE_HOOKS_DIR}/../Pipfile pipenv run lint
@junglie85
junglie85 / basic-makefile
Created September 24, 2019 07:20
Useful Makefile template
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
BASE_DIR := ${mkfile_dir}
help: ## Displays a list of make targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@junglie85
junglie85 / until-pg-ready
Created September 24, 2019 07:17
Wait until postgres is ready
until pg_isready -U postgres -h 127.0.0.1 -p 5432; do sleep 1; done
@junglie85
junglie85 / acronym.md
Last active January 14, 2019 17:06
acronym generator

acronym.h:

#if !defined(ACRONYM_H)
#define ACRONYM_H

#include <string>
#include <vector>

namespace acronym {
@junglie85
junglie85 / rust-min-max-iterator-converter.md
Last active January 3, 2019 10:25
Rust Custom Iterator Converter

One of my New Years resolutions is to learn Rust. The following code is part of a minimax scoring algorithm:

if depth % 2 == 0 {
    children.iter()
        .map(|child| TreeNode::score_depth(child, depth + 1))
        .max()
        .unwrap()
} else {
    children.iter()

Keybase proof

I hereby claim:

  • I am ambye85 on github.
  • I am amb85 (https://keybase.io/amb85) on keybase.
  • I have a public key ASDvopOEuL2VOaA3iuZexj833g5IbgHH7Q7dDag3jTldqAo

To claim this, I am signing this object: