Skip to content

Instantly share code, notes, and snippets.

View mortymacs's full-sized avatar

Morteza NourelahiAlamdari mortymacs

View GitHub Profile
@mortymacs
mortymacs / Jenkinsfile
Created October 16, 2020 11:17 — forked from oifland/Jenkinsfile
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@mortymacs
mortymacs / gitflowrebasing.md
Created September 30, 2020 21:51 — forked from markreid/gitflowrebasing.md
git flow with rebasing
@mortymacs
mortymacs / zmq-publisher.cpp
Created September 26, 2020 17:21 — forked from hmartiro/zmq-publisher.cpp
ZeroMQ pub/sub usage and latency timing for C++11
/**
* Example of ZeroMQ pub/sub usage for C++11.
*/
#include <zmqpp/zmqpp.hpp>
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
@mortymacs
mortymacs / pipe.go
Created September 12, 2020 20:49 — forked from matishsiao/pipe.go
named pipe sample code
package main
import (
"bufio"
"fmt"
"log"
"os"
"syscall"
"time"
)
@mortymacs
mortymacs / libtar-list.c
Created September 7, 2020 12:52 — forked from cat-in-136/libtar-list.c
Study for reading/writing a tar file using libtar
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <libtar.h>
int main(int argc, char *argv[]) {
TAR *tar = NULL;
int ret = 0;
int exitcode = 0;
@mortymacs
mortymacs / ffmpeg-example.go
Created September 4, 2020 10:33 — forked from peterhellberg/ffmpeg-example.go
FFmpeg from Go usage example
package main
import (
"os/exec"
)
func newCmd(imageFile, audioFile, outFile string) *exec.Cmd {
return exec.Command("ffmpeg",
"-r", "1",
"-loop", "1",
@mortymacs
mortymacs / AVL Tree.cpp
Created August 31, 2020 13:29 — forked from harish-r/AVL Tree.cpp
AVL Tree Implementation in C++. Self Balancing Tree
/* AVL Tree Implementation in C++ */
/* Harish R */
#include<iostream>
using namespace std;
class BST
{
(Dijkstra and plain A* are generally not included here as there are thousands of
implementations, though I've made an exception for rare Ruby and Crystal versions,
and for Thor, Mapzen's enhanced A*. )
A* Ruby https://github.com/georgian-se/shortest-path
A* Crystal https://github.com/petoem/a-star.cr
A* (bidirectional with shortcuts) C++ https://github.com/valhalla/valhalla
NBA* JS https://github.com/anvaka/ngraph.path
NBA* Java https://github.com/coderodde/GraphSearchPal
NBA* Java https://github.com/coderodde/FunkyPathfinding
@mortymacs
mortymacs / bin2c.c
Created July 20, 2020 19:24 — forked from albertz/bin2c.c
bin2c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv) {
assert(argc == 2);
char* fn = argv[1];
FILE* f = fopen(fn, "r");
printf("char a[] = {\n");
unsigned long n = 0;
while(!feof(f)) {
@mortymacs
mortymacs / chunker_example.cpp
Created July 17, 2020 20:03 — forked from marcinwol/chunker_example.cpp
Split vector, list or deque into chunks of an equal size in C++
/**
* Split container into chunks of an equal size
*
* An example C++11 function called chunker that takes
* a container (vector, list, deque), divides it
* into equal chunks of a given size, and returns
* container of chunks.
*
*
* The example code is based on the two following posts: