Skip to content

Instantly share code, notes, and snippets.

@yuvalif
yuvalif / djc.cpp
Created January 8, 2018 09:43
This program demonstrate how to use boost graph library to calculate Disjoint Components in a graph
View djc.cpp
#include <cstdlib>
#include <vector>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/graph/undirected_dfs.hpp>
#include <boost/graph/connected_components.hpp>
// this class can be used to randomly decide if two
// RandomMatcher objects match or not
template<unsigned N>
@yuvalif
yuvalif / Makefile
Created February 5, 2018 08:42
Making all .cpp files in the directory, each one into its own target
View Makefile
# making all .cpp files in the directory
# each one into its own target
CXX ?= g++
CXXFLAGS ?= -Wall -std=c++11
.PHONY: all clean
SRCS = $(wildcard *.cpp)
@yuvalif
yuvalif / post_install.sh
Last active March 12, 2018 13:55
Linux (fedora 27) post install script
View post_install.sh
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <hostname> <email>"
exit 1
fi
echo "Post install process for Fedora Core 27"
# TODO: verify corret version and verify run-once
@yuvalif
yuvalif / nuke-minikube.sh
Last active March 13, 2018 19:52
uninstall script for minikube
View nuke-minikube.sh
#!/bin/bash
# https://kubernetes.io/docs/getting-started-guides/minikube/
# stop and delete
minikube stop
minikube delete
# remove local cache
rm -rf ~/.kube ~/.minikube
View tmux.conf
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
View openshift-inventory.ini
# Create an OSEv3 group that contains the masters and nodes groups
[OSEv3:children]
masters
nodes
# Set variables common for all OSEv3 hosts
[OSEv3:vars]
# SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root
View override.go
ackage main
import "fmt"
// assume this is the original implementation of the callback:
/*
// by default the callback say hello only to jane
PrintCallback(name string) bool {
if name == "jane" {
return true
}
@yuvalif
yuvalif / matlab-to-cpp-guideleines.md
Last active July 22, 2018 08:59
some guidelines to authors of matlab/octave code so it is easier to convert it to C/C++
View matlab-to-cpp-guideleines.md

matlab/octave and C++

  1. use parentheses around “if” conditions

good:

if (x = y && (x + y > 3))

not good:

@yuvalif
yuvalif / matlab-to-cpp.sh
Last active July 24, 2018 08:29
some preparations for converting a matlab/octave file to cpp
View matlab-to-cpp.sh
# fix comments
sed -i 's/%/\/\//g' $1
# fix "end"
sed -i 's/end/}/g' $1
# fix "3 dots"
sed -i 's/\.\.\.//g' $1
# fix "elseif"
View docker-complete-cleanup.sh
# removed stopped container
docker container prune
# remove all images with no running containers
docker image prune --all