Skip to content

Instantly share code, notes, and snippets.

View lib.sh
#!/bin/bash
set -euo pipefail
MATTERMOST_URL="http://mattermost.qwant.loc"
MATTERMOST_API_URL="$MATTERMOST_URL/api/v4"
header_file=/tmp/header
body_file=/tmp/body
function request # ENDPOINT CURL_ARGUMENTS...
@Jules-Baratoux
Jules-Baratoux / docker-service-run
Created May 24, 2019
docker run based on docker service commands
View docker-service-run
#!/bin/bash
set -euo pipefail
# Usage:
# docker-service-run --tty alpine ls
#
function docker-service-wait # SERVICE
{
local interval=0.5s
View graph.c
/*
* graph.c
*/
#include <stdlib.h>
#include <string.h>
#include "graph.h"
#include "list.h"
#include "set.h"
@Jules-Baratoux
Jules-Baratoux / dlist.h
Last active Aug 29, 2015
Project #2 – dlist
View dlist.h
#pragma once
#include <cassert>
#include <iterator>
#include <algorithm>
using std::equal;
using std::distance;
using std::copy;
namespace Project2
{
@Jules-Baratoux
Jules-Baratoux / one.cpp
Created May 29, 2015
Homework #8 – Object construction & const-correctness
View one.cpp
struct Foo { int i; };
int main()
{
Foo t();
t.i = 7;
}
@Jules-Baratoux
Jules-Baratoux / IntegerRange.hh
Last active Aug 29, 2015
Homework #7 – IntegerRange::iterator
View IntegerRange.hh
#pragma once
#include <iterator>
// Represents all integer values in the range [low, high).
// low must be <= high.
template <typename Int>
struct IntegerRange
{
struct iterator : public std::iterator<std::input_iterator_tag, Int>
{
@Jules-Baratoux
Jules-Baratoux / compress.hh
Last active Aug 29, 2015
Homework #6 – palindrome & compress
View compress.hh
#pragma once
#include <cassert>
// compress accepts a forward iterator range [first, last) and an output iterator.
// compress copies the elements from the iterator range to the output iterator
// eliminating all consecutive duplicates.
template <typename ForwardIterator, typename OutputIterator>
void compress(ForwardIterator first, const ForwardIterator last, OutputIterator result)
{
if (first != last)
@Jules-Baratoux
Jules-Baratoux / hw7.c
Last active Aug 29, 2015
Homework #7 – outputSorted
View hw7.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <alloca.h>
#include <assert.h>
#include "heap.h"
typedef struct Person_
{
@Jules-Baratoux
Jules-Baratoux / main.cpp
Created May 22, 2015
Project #1 – BigInt
View main.cpp
/*===========================================================================
* Project #1 - CSE40478
*===========================================================================*/
#include <sstream>
#include <stdexcept>
#include <string>
using namespace std;
#include "UnitTest++.h"